This section focuses on serial queues in multi-threading and scrolling view Uiscrollview.
I. Multi-Threading
This section simply describes the multi-threaded serial queue, which is the sequential execution of the task by joining the thread queue.
(1) The current methods of iOS multithreading are mainly GCD and Nsoperation, the former is the C language level, the latter is encapsulated, more object-oriented features of the API.
(2) UI interaction is carried out in the main thread, so in order to ensure the process of the interactive process comfortable, similar to the download time-consuming operation is required to execute outside the main thread, otherwise the user will not be able to manipulate the phone scene.
At this point through multi-threading, you can download pictures and other time-consuming operations alone, complete and then callback the main thread, refresh the UI interface, so that the interaction process more smoothly. For more details, demo demo
two. Uiscrollview
Note that setting the contentsize, which is what the scrolling view shows, can be imagined as a canvas, the phone moving on the canvas, the contents of the canvas viewed through the screen, and the ability to zoom in and out of the canvas's content.
Note Set the scale maximum, minimum scale value, and the agent method "Viewforzoominginscrollview" to implement the scaling operation, otherwise the Uiscrollview scaling operation will not respond.
Three. Use the iOS-enabled wait-and-spin effect to make the interactive process more reasonable.
With the UI control Uiactivityindicatorview, tick enable animation and hide two effects after the download starts, the animation starts after the start of the animation, and when the task is finished, it stops and hides the control.
In addition, it is recommended that the control is set up in the document view, especially when the UI controls are more convenient, and you can see the yellow exclamation mark after using the automatic layout effect, which makes it easy to select the corresponding auto-correction action.
、
: (Demo:http://files.cnblogs.com/colinhou/Imaginarium.zip)