WEB开发网
开发学院手机开发iPhone 开发 iPhone objective c 截屏代码 阅读

iPhone objective c 截屏代码

 2010-10-19 20:49:17 来源:WEB开发网   
核心提示:objective c 截屏代码-(void)save{UIGraphicsBeginImageContext(mybackgroundview.bounds.size); //currentView 当前的view[mybackgroundview.layer renderInContext:UIGraphicsGe

objective c 截屏代码

-(void)save{

UIGraphicsBeginImageContext(mybackgroundview.bounds.size); //currentView 当前的view

[mybackgroundview.layer renderInContext:UIGraphicsGetCurrentContext()];

UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();

UIGraphicsEndImageContext();

UIImageWriteToSavedPhotosAlbum(viewImage, nil, nil, nil);

}截取 您想要的一层

UIGraphicsBeginImageContext(CGSizeMake(320, 300)); //currentView 当前的view

[self.view.layer renderInContext:UIGraphicsGetCurrentContext()];

UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();

UIGraphicsEndImageContext();

UIImageWriteToSavedPhotosAlbum(viewImage, nil, nil, nil);

截取自定义的大小

刚刚用到 不知道 是不是您想要的

Tags:iPhone objective 代码

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接