2011-01-31 65 views
2

我有問題的tableview的編輯模式。當我們將表格設置爲編輯模式時,它將右側的行單元格縮進右側的編輯字段。我想阻止這種事情發生。我已經設置了cell.shouldIndentWhileEditing = NO;但這並沒有改變任何東西。UITableViewCell ShouldIndentWhen編輯問題

還有一點需要注意的是,這個單元格是通過編程的方式構建的,例如,

static NSString *CellIdentifier = @"ListingCustomCell"; 

    UITableViewCell *cell = (UITableViewCell *) [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 

    if (cell == nil) { 

     cell = [[UITableViewCell alloc]initWithFrame:CGRectMake(0, 0, tableView.frame.size.width, 34) reuseIdentifier:CellIdentifier]; 

    } 
    cell.shouldIndentWhileEditing = NO; 

//SETUP CELL FIELDS 

//return cell; 

關於什麼我做錯了任何想法?

感謝

回答

0

也許你的UITableViewDelegate在- (BOOL)tableView:(UITableView *)tableView shouldIndentWhileEditingRowAtIndexPath:(NSIndexPath *)indexPath返回YES。如果實現委託方法,它將覆蓋單元格上的值。

+0

該方法未實現。我實現了它,並返回NO,但它仍然沒有區別? – IPadHackAndSlash 2011-01-31 23:17:19

0

您是否閱讀過這部分文檔?

該屬性僅影響在組合的 樣式()中創建的表視圖;它對 UITableViewStylePlain表格視圖沒有影響。

也許這就是你的情況。