IOS --- optimize applications

Source: Internet
Author: User

I. First launch

First: quick speed. It is faster to start for the first time. If it cannot be faster, you need to display a loading image in advance. This will give the user a good feeling, instead of letting the user Delete the image because of the slow speed.

Second, crash is not supported. The application crashes during startup. For example, if the system does not respond for a long time, the system will kill the application. For example, the application that needs to access the network may crash if there is no network or the network is poor, in this case, you need to pre-load or split the network event from the UI display for asynchronous operations. Third, the internal file, XIB file, will be compiled into a nib binary file during compilation, which is a large memory file. When there are many views on an XIB file, this will cause a lot of performance problems. The compiled XIB file is a large file and will be very slow during loading.

Solution: first, use less XIB files and try to write them in code. Second, divide the XIB file into n xib files. Each XIB file contains as few views as possible. Third: Using storyboard, this storyboard has been optimized and will not increase the level of the XIB file. The disadvantage is that it only supports systems above ios5. Fourth, delayed resource loading. It is best to load Resources in the viewdidload function. Fifth, asynchronous download is required for network downloads.

Ii. workflow. First, the alert pop-up dialog box is displayed. This will interrupt the user's use process, and cause a small amount of information to the user and infringe on the user. If you have to prompt the user, you can display a floating window for the prompt. This floating layer cannot interrupt user behavior. alert dialog is used only in very serious cases. Second, reduce the user's tab.

3. response. Fast response speed.

1. network resources. (1) sendsynchronousrequest is not recommended. This is a synchronous method, even in the thread. It is best to use the connectionwithrequest: deleget Asynchronous Method to obtain network resources. (2) Cancel unnecessary network access. It is best to create several network request queues without the necessary network requirement queues, this queue can be dropped by cancel at any time, and must be maintained by the necessary network request queues; (3) Use Network cache; (4) Incrementally process data and obtain data at, respectively, it is not necessary to display all the data at a time. (5) Too many threads should not be opened. Too many threads will slow the network, especially for images or portraits.

Second, the image loading. Generally, JPEG images are slower than PNG images loading.

The time for jpge compression and decompression is unstable, which causes you to be unable to control the time during processing. PNG is a lossless compression format, so the image is often very large. At this time, it needs to be optimized. This tool is included in xcode and the command is pngcrash-iPhone-F 0 orig.png optimized.png. Generally, images requested by the network cannot be optimized in this way, so we can use some code to optimize the image, such as optimizing the Alpha value of the image, and optimizing the effect through the cache-based pattern.

Third, when loading in cells of table views, sliding may cause a very bad situation.

Optimize the rendering process of each view to save the loading process of your cell. Customcell is not easy to use. Use the drawrect method instead. There are many tips for reading the document. Do not match the API. Use instrument to find the Jin bottle.

Iv. Details details

First, the appearance of appearance should be nice. Some UIS can use the hack method to change the UI of the system. ios5 shows a method for modifying the UI appearance, but only supports ios5.

Second: animation. Good animation effects will give users a pleasant feeling.

Third: Status Bar, which can be hidden. However, once hidden, it will be hard for the user to see the power and time.

4. State saving: After receiving the call, the user still wants to play with your application. However, if you do not save the current state of your application, it can cause great psychological harm to users.

Related Article

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.