Answer the question
In order to leave comments, you need to log in
How to speed up controller loading?
Good day, in my controller I have to fill in 25 arrays with rows
, if I initialize them in viewDidLoad, then the transition to the controller (through the button) takes place with a lag (the program sticks)
when I initiate them in viewWillApper, then the transition has become faster
Tell me how and where better to initiate them? Why is the floor faster in the 2nd method (I understand that it is a call when drawing
)
Answer the question
In order to leave comments, you need to log in
Long-running tasks should not run in the UI thread at all
Common practice is to put them in the background and then return to the main thread
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
/* долгая операция */
dispatch_async(dispatch_get_main_queue(), ^{
/* обновляем ui*/
});
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question