【问题标题】:Image With Borders in iphoneiphone中带边框的图片
【发布时间】:2012-02-25 06:08:34
【问题描述】:

我想为我的 iphone 应用程序中的图像应用不同的边框。我正在从相机捕捉图像。现在我有一些不同的边框,我想将该边框应用于图像。我怎么做 ??

【问题讨论】:

    标签: iphone ios uiimageview


    【解决方案1】:
    - (UIImage*)imageWithBorderFromImage:(UIImage*)source
    {
      CGSize size = [source size];
      UIGraphicsBeginImageContext(size);
      CGRect rect = CGRectMake(0, 0, size.width, size.height);
      [source drawInRect:rect blendMode:kCGBlendModeNormal alpha:1.0];
    
      CGContextRef context = UIGraphicsGetCurrentContext();
      CGContextSetRGBStrokeColor(context, 1.0, 0.5, 1.0, 1.0); 
      CGContextStrokeRect(context, rect);
      UIImage *testImg =  UIGraphicsGetImageFromCurrentImageContext();
      UIGraphicsEndImageContext();
      return testImg;
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-01-01
      • 2016-11-21
      • 2017-12-17
      • 1970-01-01
      • 2014-01-15
      相关资源
      最近更新 更多