你的位置:首页 > 软件开发 > 操作系统 > CoreGraphics相关方法

CoreGraphics相关方法

发布时间:2015-11-21 19:00:05
// 将view转为image(不经常用到的功能)(摘自SCCatWaitingHUD)- (UIImage *)convertViewToImage{  CGSize s = self.bounds.size; //下面方法,第一个参数表示区域大小。 ...

// 将view转为image(不经常用到的功能)(摘自SCCatWaitingHUD)

- (UIImage *)convertViewToImage

{

  CGSize s = self.bounds.size;

    //下面方法,第一个参数表示区域大小。

    //第二个参数表示是否是非透明的。如果需要显示半透明效果,需要传NO,否则传YES。

    //第三个参数就是屏幕密度。

  UIGraphicsBeginImageContextWithOptions(s, NO, [UIScreen mainScreen].scale);

  [self.layer renderIntoContext:UIGraphicsGetCurrentContext()];

  UIImage *image = UIGraphicsGetImageFromCurrentImageContext();

  UIGraphicsEndImageContext();

  return image;

}

(未完待续)


原标题:CoreGraphics相关方法

关键词:

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。

可能感兴趣文章

我的浏览记录