Execute the function immediately after loading the view, iphone

I am creating a tab application. One of the tabs is the rss channel, which is a navigation application. but when I click the bat tab button, it takes some time to load the view of this tab. This is because the application is waiting for the feed to load from the server. Is there a way to load a view before downloading this feed. At the moment, I am passing the request in the viewDidLoad method. What creates the problem. In which part should I move the code so that the view loads instantly when I click a button on the panel.

+3
source share
3 answers

I recommend this wonderful article on this subject on iCodeBlog, it is a very elegant way to do this. If you send a downloadable RSS feed as NSOperation, it will be beautifully designed in the background without blocking the main stream.

+1
source

using:

[self performSelector:@selector(performRSS:) withObject:<nil afterDelay:0.3f];

or

[NSThread detachNewThreadSelector:@selector(performRSS:) toTarget:self withObject:nil];

and place the associated RSS feed code in a separate function called "performRSS".

+1
source

Source: https://habr.com/ru/post/1735560/


All Articles