【问题标题】:How to show disclosure indicator while cells are in edit mode?如何在单元格处于编辑模式时显示披露指示器?
【发布时间】:2010-07-19 17:15:53
【问题描述】:

我有一个可以编辑的 UITableView。我这样显示单元格:

- (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];
        cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    }

    // Configure the cell...
    STWatchList *mySTWatchList;
    mySTWatchList = [items objectAtIndex:indexPath.row];

    cell.textLabel.text = mySTWatchList.watchListName;

    return cell;
}

当用户正在编辑时,我想显示披露指示器。我怎样才能做到这一点?

【问题讨论】:

    标签: iphone objective-c cocoa-touch uitableview


    【解决方案1】:
    cell.editingAccessoryType = UITableViewCellAccessoryDisclosureIndicator;
    

    【讨论】:

      【解决方案2】:
          if (indexPath.row==0)
          {
              cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier] autorelease];
              cell.selectionStyle = UITableViewCellSelectionStyleGray;
              cell.editingAccessoryType = UITableViewCellAccessoryDisclosureIndicator;
          }
      
          else
          {
              cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
              cell.selectionStyle = UITableViewCellSelectionStyleNone;
          }
      

      【讨论】:

        猜你喜欢
        • 2020-03-23
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-07-09
        • 1970-01-01
        • 1970-01-01
        • 2010-11-19
        相关资源
        最近更新 更多