iOS
来源:互联网 发布:淘宝刷单详细流程图 编辑:程序博客网 时间:2024/05/28 04:53
其中有一个必须的参数,类型是 UIView * ,这个参数表示您要截取的那部分视图。有两个方法,一个是截取该视图的整个部分,还要一个方法是截取该视图的某一部分,方法如下:
//获得某个范围内的屏幕图像
- (UIImage *)captureScreenForView:(UIView *)currentView andFrame:(CGRect)rect
{
UIGraphicsBeginImageContext(currentView.frame.size);
CGContextRef context =UIGraphicsGetCurrentContext();
CGContextSaveGState(context);
UIRectClip(rect);
[currentView.layerrenderInContext:context];
UIImage *theImage =UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return theImage;
}
// 截取全屏
-(UIImage *)captureScreenForView:(UIView *)currentView {
UIGraphicsBeginImageContext(currentView.frame.size);
[currentView.layerrenderInContext:UIGraphicsGetCurrentContext()];
UIImage *viewImage =UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return viewImage;
}
- iOS
- iOS
- IOS
- iOS
- iOS
- IOS
- ios
- iOS
- iOS
- IOS
- iOS
- ios
- ios ~~~~~
- ios
- IOS
- IOS
- IOS
- ios
- 数字证书的基础知识
- 高德地图 二 key 值错误的问题-location Error, ErrCode:7, errInfo:KEY错误
- Android Studio 修改注释模板中的${USER}变量
- RocketMQ实战(一)
- 腾讯Web前端大会 WebGL&Three.js(MR_LP)
- iOS
- 2017.06.26 笔记 MTK手机版本信息修改
- SpringBoot集成MyBatis开启事务
- js cookie的使用
- 算法分析与设计第十八周:592. Fraction Addition and Subtraction
- Unity 委托事件
- android中ListView,ScrollView滚动条常显和隐藏
- java实现发送HTTP的POST请求,返回数据以及请求状态
- 一分钟教你知道乐观锁和悲观锁的区别