2010-07-19 57 views
19

我有一個可以編輯的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; 
} 

當用戶正在編輯時,我想顯示披露指標。我怎樣才能做到這一點?

回答

54
cell.editingAccessoryType = UITableViewCellAccessoryDisclosureIndicator; 
0
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; 
    } 
相關問題