Uiscrollview Performance Optimization-View to Image

Source: Internet
Author: User

into the map Alarm app, the layer relationship is like this: Subwayview on the lines on the first line of the elements: lines, site name-label, site location (circled)-view.shapelayer Uibezierpath way to draw; Subwaview Add on the ScrollView, and then realize the zoom out operation, found that the upper and lower left and right mobile time is not very smooth feeling, analysis should be Subwayview subview number (more than 200) has an impact.

Think of the method Subwayview after drawing all the Subview, convert it to image, then remove all the Subview, then Nest ImageView on Subwayview, then scale is equivalent to scaling one iamge.

The test was smooth enough. The problem depends on the solution. But found that the text of the label is very vague, especially after zooming in, so it is necessary to improve the conversion of the image pixels, using the following methods:

-(UIImage *) Convertviewtoimage: (uiview*) v{    // Set high resolution to prevent text blur    false, [[ UIScreen Mainscreen] scale]*2);    [V.layer Renderincontext:uigraphicsgetcurrentcontext ()];        UIImage*image = uigraphicsgetimagefromcurrentimagecontext ();        Uigraphicsendimagecontext ();         return image;    }

Uiscrollview Performance Optimization-View to Image

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.