She*_*lam 6 iphone cocoa-touch objective-c uitableview
我有8个单元格在我的UITableViewController中构建.我想知道如何在第4和第8个细胞上显示披露指标.现在我正在构建它
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
Run Code Online (Sandbox Code Playgroud)
虽然我完全清楚它会为每个细胞添加一个披露指标
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
Run Code Online (Sandbox Code Playgroud)
ind*_*gie 18
使用简单的if语句:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
... // do whatever
UITableViewCellAccessoryType accessoryType = UITableViewCellAccessoryNone;
if (indexPath.row == 3 || indexPath.row == 7) {
accessoryType = UITableViewCellAccessoryDisclosureIndicator;
}
cell.accessoryType = accessoryType;
... // do whatever
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
17770 次 |
| 最近记录: |