簡體   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