BOOL
右...まあ-グローバルな例が必要ですBOOL isManual;
UITableViewDatasource の各メソッドで、この bool をチェックする必要があります。
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
}
if(isManual){
// set cell content for manual
}
else{
//set cell content for DCHP
}
return cell;
}
// this function allows you to set a table view cell as editable
// look up UITableView delegate methods for more :)
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
if(isManual){
return YES;
}
else{
return NO;
}
}
そして似ています。
次に、セグメント化されたコントロールのコールバック メソッドで isManual を変更reloadData
し、テーブルで次のようにします。
- (void)segmentedControlChanged:(id)selector {
UISegmentedControl *control = selector;
int selected = [control selectedSegmentIndex];
if(selected == 0){
isManual == NO;
}
else{
isManual == YES;
}
[self.tableView reloadData];
}
多少あいまいですが、多少役立つことを願っています。:)