Tuesday 15 May 2012

iphone - UITableView reloadData doesn't work -


I have read all the same questions and have tried all the suggestions, still nothing. Maybe one can see my flaw.

My visual controller starts with another view controller, one of the two buttons, send a button tap NSNotification (with attached arrays), and this view controller fears this notification and then this method Calls:

  - (zero) addContentToArray: (NSNotification *) An alert {array = [NSArray arrayWithArray: [an information object]]; ([Array calculation] == 6)? (Category = Yes): (Category = NO); [MyTableViewReload Data]; NSLog (@ "% d", [ARL count]); NSLog (@ "% @", myTableView); }   

This method is called all the time, I can see that by changing the ARA count here the notification object is the array passed from the previous view controller, and I have these objects in my local array property I specify - this is my UITableView source. So what do I do, I try to reuse UITableView to display the elements of the array being passed. And it works well for the first array (whichever is earlier).

When I tap the second button, the new array is passed successfully (as previously mentioned, I know that the [array count] is different than the log of: 3 different arrays 3 vs 6 objects) However, what is not happening is that the UITableView does not refresh (though when the row is selected in the table, the values ​​are from the correct array, even if the wrong values ​​are displayed).

Here UITableView data source methods:

  - (NSInteger) tableview: (UITableView *) table view numberofferaase Insension: (NSInteger) section {return [array number]; } - (UITableViewCell *) TableView: (UITableView *) Table View CellForUndApp Path: (NSIndexPath *) Index Pathway {UITableViewCell * cell = [Tableview dequeueReusableCellWithIdentifier: @ "Identifier"]; If (cell == blue) {cell = [[UTitleViews alloc] initWithStyle: UITableViewCellStyleSubtitle reuseIdentifier: @ "Identifier"]; } Cell.textLabel.text = [[Array ObjectTitxx: IndexPath.ro] ObjectForreake: @ "name"]; If (category) {cell.detailTextLabel.text = [[Array ObjectAttendX: IndexPath.ro] ObjectForekey: @ "Details"]; } Return cell;   

So, what am I doing wrong?

Some other ideas that can help:

  • NSLog (@ "% @", MyTableView); Returns (empty), which is a little worrisome MyTableView Here is the UITableView from my Nib file, which is correctly connected to the view controller, which is declared as the property and is synthesized
  • The view in view is a right ViewController of the controller, so when it is called repeatedly, see Wrapper method
  • Also, for those who are familiar with PKRevealController - when I try More attention The controller, in my opinion, says the controller, that the front controller - which takes action to reveal my view controller - that is what is centered

    I have some Also be grateful for insight and help!

    More code is needed, the part you created and MyviewControler Code> addContentToArray method. I think you use the release code for the object of MyviewControler , try to hide that part with it once.

No comments:

Post a Comment