1

Ok, so there is "static cells" content mode for creating settings-like views. Can anyone suggest how to deal with that if you have different number of settings to be displayed in different circumstances? i.e. in one case I have three cells: two cells with switches and one with button, and in other case - just last cell with button.

Should I switch back to dynamic cells? How should I handle headers' behavior in this case? Thanks

4

2 回答 2

1

I think you better use dynamic cells. for header and footer of cells and sections you can just call this methods:

- (NSString *) tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section  
{  
    return @"This will be the header!!!!";  
}

or

- (NSString *) tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section  
{  
    return @"This will be the footer!!!!";  
}

P.S. there were some methods, something like "viewForHeaderInSection" and "viewForFooterInSecton". But I don't remembre the complete implementation.

P.S^2. you have to set the Table View Style to Grouped! See this image for a tiny help

于 2013-06-23T00:34:31.653 回答
0

Static cells and a simple if in your implementation of numberOfRowsInSection: and cellForRowAtIndexPath to return your 3 static cells or just the last one depending on your condition. Simple enough.

于 2013-06-23T00:40:40.983 回答