Iphone 如何在tableview单元格中添加开关
我的基于导航的应用程序和视图是UITableviewController。我需要为特定的UIViewtable单元格添加开关控制。如何添加 也是一个经典,这个问题在这里已经被问了很多。例如,请参见。搜索Iphone 如何在tableview单元格中添加开关,iphone,cocoa-touch,uitableview,Iphone,Cocoa Touch,Uitableview,我的基于导航的应用程序和视图是UITableviewController。我需要为特定的UIViewtable单元格添加开关控制。如何添加 也是一个经典,这个问题在这里已经被问了很多。例如,请参见。搜索UITableView和UISwitch以获得更多的结果。也是一个经典,这个问题在这里已经被问了很多。例如,请参见。搜索UITableView和UISwitch以获得更多结果。您可以在中找到的-tableView:cellforrowatinexpath:方法中添加开关 您可以在中找到的-tabl
UITableView
和UISwitch
以获得更多的结果。也是一个经典,这个问题在这里已经被问了很多。例如,请参见。搜索UITableView
和UISwitch
以获得更多结果。您可以在中找到的-tableView:cellforrowatinexpath:
方法中添加开关
您可以在中找到的
-tableView:cellforrowatinexpath:
方法中添加开关
可能的重复可能的重复
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
// Configure the cell...
UISwitch *aSwitch = [[[UISwitch alloc] init] autorelease];
[aSwitch addTarget:self action:@selector(switchChanged:) forControlEvents:UIControlEventValueChanged];
[cell.contentView addSubview:aSwitch];
return cell;
}