objective c 截屏代碼
-(void)save{
UIGraphicsBeginImageContext(mybackgroundview.bounds.size); //currentView 當(dāng)前的view
[mybackgroundview.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
UIImageWriteToSavedPhotosAlbum(viewImage, nil, nil, nil);
}截取 您想要的一層
UIGraphicsBeginImageContext(CGSizeMake(320, 300)); //currentView 當(dāng)前的view
[self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
UIImageWriteToSavedPhotosAlbum(viewImage, nil, nil, nil);
截取自定義的大小
剛剛用到 不知道 是不是您想要的
更多信息請查看IT技術(shù)專欄
由于各方面情況的不斷調(diào)整與變化,易賢網(wǎng)提供的所有考試信息和咨詢回復(fù)僅供參考,敬請考生以權(quán)威部門公布的正式信息和咨詢?yōu)闇?zhǔn)!