today, in the development process, a problem is encountered, that is, a control needs to be done separately. If you are on the screen, I believe you are familiar with it, but for a single control? For example, the most common UITableViewCell, because the cell is one of the most commonly used controls, if you know it, then other controls will be solved.
This apple seems to have helped us to think about it, if you support the iOS7 and above the system, then only need to call a line of code.
UIView *snapshot = [Thecell snapshotviewafterscreenupdates:yes];
Isn't it convenient?
But let's look at the definition of this method:
-(UIView *) Snapshotviewafterscreenupdates: (BOOL) afterupdates Ns_available_ios (7_0);
I wipe! Only support iOS7 and above! Can that iOS6 be swollen? Will not run a crash?
Table anxious ~IOS6 on our own way ~
CGRect rect = [self RectForRowAtIndexPath:self.indexOfTheCell]; Uigraphicsbeginimagecontext (rect.size); Cgcontextref context = Uigraphicsgetcurrentcontext (); [Thecell.layer Renderincontext:context]; UIImage *img = Uigraphicsgetimagefromcurrentimagecontext (); Uigraphicsendimagecontext (); Uiimageview *imageview = [[Uiimageview alloc] initwithframe:rect]; Imageview.image = img;
hahaha. We got it!
So we just need to set up a branch and then we can.
The cell is localized in iOS