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);
截取自定義的大小
剛剛用到 不知道 是不是您想要的
更多信息請(qǐng)查看IT技術(shù)專欄
2025國(guó)考·省考課程試聽(tīng)報(bào)名