I want to know if this control derives from UITableViewController?
If so, how?
Thank you.
是的,它是一个表视图控制器..分组样式...第一部分有7行,我不能肯定地说是否派生,但是我想不是...您可以将View添加到特定行,以便自定义单元格...派生tableCell不是必需的
Not sure what you mean.
If you mean how they have UISwitch in a table cell then its probably a subclass of UITableViewCell that they put a UISwitch in.
This is how you add the UISwitch view to the table cell. (As an accessory)
- (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;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.