0

I have a UITableView that displays data from invoking a REST web service. I'd like in that UITableView to set section's title from an NSMutableArray that get its data after connection to the Web Service. Can I control the process as follows:

  • Connecting to the web service and populate all NSMutableArray
  • Get data from a specific NSMutableArray
  • Set section's title and then show the UITableView.

The problem is that the compiler triggers the UITableView before getting data from web service.
Is that possible?

timss
  • 9,982
  • 4
  • 34
  • 56
androniennn
  • 3,117
  • 11
  • 50
  • 107

1 Answers1

1

See this for setting the section headers, using this method should allow the next method call to work as intended Set UITableView Section Header Programmatically

Call this after the Data has been loaded from your REST service.

the reloadData method reloads both rows and sections, so should correctly load not only your new section headers but any new data for the rows

[myTableView reloadData]

(i.e. in ViewDidLoad If you're loading the data in ViewWillLoad. Or if you know that the code following your data loading only is called after the array is filled)

Using this approach, you should be able to not only

Community
  • 1
  • 1
Ken W
  • 962
  • 4
  • 12
  • 19