iphone在视图加载后执行一个函数(Execute a function just after the view loads, iphone)

编程入门 行业动态 更新时间:2024-10-25 10:32:21
iphone在视图加载后执行一个函数(Execute a function just after the view loads, iphone)

我正在创建一个tabbar应用程序。 其中一个选项卡用于rss feed,这是一个导航应用程序。 但是当我单击tab tab按钮时,需要一段时间来加载该选项卡的视图。 这是因为应用程序正在等待从服务器加载订阅源。 有没有办法在加载该Feed之前加载视图。 截至目前,我正在viewDidLoad方法中提供请求。 这就是造成问题的原因。 我应该移动代码以便在单击标签栏按钮时立即加载视图。

I am creating a tabbar application. One of the tabs is for an rss feed, which is a navigation application. but when i click the tab bat button, it is taking a while to load the view of that tab. It is because the application is waiting for the feed to be loaded from the server. Is there any way to load the view before the loading of that feed takes place. As of now, i'm giving the request in the viewDidLoad method. Thats what is creating the problem. To which part shall i move the code so that the view is loaded instantaneously when clicking the tabbar button.

最满意答案

我在iCodeBlog上推荐这篇关于这个主题的精彩文章 ,这是一种非常优雅的方式。 如果您将RSS订阅源加载为NSOperation ,它将在后台很好地进行,而不会阻止您的主线程。

I recommend this great article on this subject on iCodeBlog, it's a very elegant way of doing this. If you submit your rss feed loading as an NSOperation, it will take place nicely in the background without blocking your main thread.

更多推荐

本文发布于:2023-04-29 09:45:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1335882.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:视图   加载   一个函数   iphone   loads

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!