次のような numberOfSections... メソッドがあります。
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
BOOL showContacts = self.selectedReminderMessageService != RMReminderMessageServiceTwitter ? YES : NO;
if (self.isEditing) {
if (showContacts) {
return 5;
} else {
return 4;
}
} else {
if (showContacts) {
return 4;
} else {
return 3;
}
}
}
cellForRowAtIndexPath... メソッドはどのように作成すればよいですか? 次のように、考えられるすべての構成をリストする必要がありますか?
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
BOOL showContacts = self.selectedReminderMessageService != RMReminderMessageServiceTwitter ? YES : NO;
NSInteger section = [indexPath section];
if (self.isEditing) {
if (showContacts) {
if (section == 0) {
// repeat to section 4 with else if's
}
} else {
if (section == 0) {
// repeat to section 3 else if's
}
}
} else {
if (showContacts) {
if (section == 0) {
// repeat to section 3 else if's
}
} else {
if (section == 0) {
// repeat to section 2 else if's
}
}
}
}
これをより効率的な方法で行うことはできますか?