The methods we use are as follows:
Dimensions are in accordance with
Uigraphicsbeginimagecontext (Cgsizemake (+) ); // CurrentView The current view creates a bitmap-based graphics context and specifies a size of [Self.view.layer Renderincontext:uigraphicsgetcurrentcontext ()]; // Renderincontext renders the recipient and its child scopes to the specified context UIImage *viewimage = Uigraphicsgetimagefromcurrentimagecontext (); // returns a picture based on the current drawing context Uigraphicsendimagecontext (); // removes the top of the stack based on the current bitmap's graphics context Uiimagewritetosavedphotosalbum (viewimage, nil, nil, nil); // then save the picture to a picture map
This method is relatively simple and generally uses this method
But there may be a more stringent clarity requirement then we need to modify this method as follows:
Uigraphicsbeginimagecontextwithoptions (Cgsizemake,0.0// CurrentView The current view creates a bitmap-based graphics context and specifies a size of [Self.view.layer Renderincontext: Uigraphicsgetcurrentcontext ()]; // Renderincontext renders the recipient and its child scopes to the specified context UIImage *viewimage = Uigraphicsgetimagefromcurrentimagecontext (); // returns a picture based on the current drawing context Uigraphicsendimagecontext (); // removes the top of the stack based on the current bitmap's graphics context Uiimagewritetosavedphotosalbum (viewimage, nil, nil, nil); // then save the picture to a picture map
The main uigraphicsbeginimagecontextwithoptions method has changed:
This should be the IOS7 and the way to set the resolution later
The screen images captured in the method below will be clearer
iOS code screenshot blur Problem Solving method