Reputation: 8947
I have an iPhone application in which I want to add two arrays to the same tableview, ie news array and deals array, which are returned by a web service. I need to load them in the same view, ie in a tableview, as if loading from a single array. Can anybody help me in achieving this?
Upvotes: 5
Views: 970
Reputation: 8947
Finally I soted it out like this.First take the two arrays.then merge it in to one array,and load the table view from that array.if u need seperate actions then in your didselect methode check whether the object contains in the first array then do something,else do another thing ...
Upvotes: 1
Reputation: 96937
Put code in the delegate methods which treats the news
and deals
arrays as two separate sections. For example, use the -tableView:cellForRowAtIndexPath:
to populate a first set of cells with news
index paths and a second set of cells with deals
index paths. Look at the UITableViewDataSource
delegate protocol.
Upvotes: 0