ios - Create UIImage of whole UICollectionView content -
i have uicollectionview. no caching haven't needed apply far, have sum of 7 different images, possibly 40 cells. not experienced in method.
-(uicollectionviewcell *)collectionview:(uicollectionview *)collectionview cellforitematindexpath:(nsindexpath *)indexpath { uicollectionviewcell *cell=[collectionview dequeuereusablecellwithreuseidentifier:@"cell" forindexpath:indexpath]; uiimageview *collectionimageview = (uiimageview *)[cell viewwithtag:102]; uilabel *balllabel = (uilabel *)[cell viewwithtag:103]; uilabel *balllabelinfo = (uilabel *)[cell viewwithtag:110]; ballshot *selectedball = [self.statsview.visitballshotcollection objectatindex:indexpath.row]; nsstring *balldetail; nsstring *labelinfo; balldetail = [nsstring stringwithformat:@"foul"]; labelinfo = [nsstring stringwithformat:@"%@",[selectedball getfoultypetext:selectedball.foulid]]; collectionimageview.image = [uiimage imagenamed:selectedball.imagenamelarge]; balllabel.text = balldetail; balllabelinfo.text = labelinfo; return cell; }
i able save displayed content of uicollectionview correct content size, not whole content.
- (uiimage *) imagewithcollectionview:(uicollectionview *)collectionbreakview { cgsize widthheight = cgsizemake(collectionbreakview.contentsize.width, collectionbreakview.contentsize.height); uigraphicsbeginimagecontextwithoptions(widthheight, collectionbreakview.opaque, 0.0); [collectionbreakview.layer renderincontext:uigraphicsgetcurrentcontext()]; uiimage * img = uigraphicsgetimagefromcurrentimagecontext(); uigraphicsendimagecontext(); return img; }
how can obtain whole content , place uiimage? if caching answer can please give me starter in setting up? in advance.
Comments
Post a Comment