繁体   English   中英

是UITableViewController吗?

[英]Is it a UITableViewController?

我想知道此控件是否源自UITableViewController吗?

在此处输入图片说明 如果是这样,怎么办?

谢谢。

是的,它是一个表视图控制器..分组样式...第一部分有7行,我不能肯定地说是否派生,但是我想不是...您可以将View添加到特定行,以便自定义单元格...派生tableCell不是必需的

不明白你的意思。

如果您是说他们如何在表单元格中使用UISwitch,那么可能是将UISwitch放入的UITableViewCell的子类。

这是将UISwitch视图添加到表单元格的方式。 (作为附件)

- (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];
    //add a switch
    UISwitch *switchview = [[UISwitch alloc] initWithFrame:CGRectZero];
    cell.accessoryView = switchview;
    [switchview release];
}

cell.textLabel.text = [NSString stringWithFormat:@"%d", indexPath.row];

return cell;
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM