NSXMLParsing 期间 ActivityIndicator 未显示
我即将编写一个简单的应用程序,其中在一个 UIView(通过 TabBar 调用)中从 URL 加载 RSS-Feed 并进行解析以在简单的 UITableView 中显示 Feed-Entry。
在此 UIView 中,我创建了一个 UIActivityIndicatorView,将其连接到 Interface Builder 中的 UIActivityIndicatorView,并设置属性“动画”和“停止时隐藏”。
NSXMLParser 在 ViewDidAppear 中启动,我
[theActityIndicator startAnimating];
在开始时调用(在开始下载 Feed-Data 并解析它之前)。
我现在的问题是,ActivityIndicator 没有显示,似乎在调用 ViewDidAppear 时视图没有显示在设备上。
对我有什么提示我可以如何管理吗?
我还定义了一个 IBAction,在其中重新加载 Feed-Data 并重新解析它。之后调用 [myTableView reloadData];
。此外,在此操作(通过工具栏中的按钮启动)时,不会显示活动指示器。
i'm about to write a simple App where in one UIView (called via TabBar) a RSS-Feed is loaded from a URL and parsed to show the Feed-Entrys in a Simple UITableView.
Within this UIView i created a UIActivityIndicatorView, connected it to a UIActivityIndicatorView in Interface Builder and set the attribute "animating" and "hide when stopped".
The NSXMLParser starts in ViewDidAppear and i'm calling
[theActityIndicator startAnimating];
at the beginning (before starting downloading the Feed-Data and parsing it).
My Problem is now, that the ActivityIndicator is not showing, it seems that the View is not Displayed on the device at the moment where ViewDidAppear is called.
Any hint for me how i can manage that?
I have also an IBAction defined where i do a reload of the Feed-Data and reparse it. After that a [myTableView reloadData];
is called. Also at this action (startet via Button in Toolbar) the Activity Indicator is not displayed.
我更改了所有代码以使用线程,现在它可以工作了。只要解析器在做他的工作,GUI 似乎就不会更新。如果您遇到同样的问题,线程是您的朋友!
i changed all the code to use Threading and now it works. As long as the Parser is doing his job, there seems to be no update to the GUI. Threading is your friend if you stuck in the same problem !