Reputation: 711
I have 4 to 5 sections in the UITableView
and each section I would like use different custom UITableViewCell
.
Assigning cell under delegate function
-(UITableViewCell*)tableView:(UITableView*)tableView cellForRowAtIndexPath:(NSIndexPath*)indexPath
But how do I assign differnt cells for different sections of the table?
Upvotes: 0
Views: 90
Reputation: 11839
You can use index path for identifying different sections and different implementation for different sections-.
-(UITableViewCell*)tableView:(UITableView*)tableView cellForRowAtIndexPath:(NSIndexPath*)indexPath {
if(indexPath.section == 0) {
// Have custom implementation for first section
}
else if(indexPath.section == 1) {
// Have custom implementation for second section and similarly others
}
}
Upvotes: 2