0

I have a application that is made of "Navigation Controller" whith "UITableViewController" which contains a navigation item with a search field. In the storyboard, the Search Bar is inside the TableView.

I request XML from a server, if I do it directly on the main thread, it's very slow but it works, the informations from the server is getting shown on the CellView with "reloadData". But when I do it with a "performSelectorOnBackground" I managed to get the data but I have to click on the "Cancel" button of the search bar to show the result I just queried!

I tried already: "[self.tableView performSelectorOnMainThread:@selector(reloadData) withObject:nil waitUntilDone:NO];" but it doesn't change it. The worst is that when if I put a "NSLog" in "cellForRowAtIndexPath" it shows the content of the array. And the "searchBarCancelButtonClicked" is totally empty.

Sorry English is not my native language, and thanks a billion time for your help!

EDIT 18/04/12: Now the TableCellView gets populated correctly asynchronously but there is a problem. When the request from XML is ready, I can see it in the ViewController of my current view. But I have to type another letter in the searchBox in order to "push" the previous result to my tableViewCell. Now in my current view I call another class that in another thread (dispatch_async) ask another function to parse the XML and once done, I send a "NSNotification" so my current view initialise my NSMutableArray that is used to populate the form. Do someone has an idea on how to trick it? Thanks a billion time!

4

1 回答 1

0

完成数据解析后,您调用了 [tableview reloadData];。它将用更新的数据填充您的数据。

于 2012-04-17T13:53:24.143 回答