2013-06-27 75 views
0

我創建了一個具有多個字段和一些其他屬性的自定義UITableViewCell子類。由於我在我的UITableViewController中使用了這個新單元格,單元格不會對「滑動刪除」手勢做出反應。自定義UITableViewCell刪除按鈕不顯示

爲了測試我是否在我的委託中丟失了某些東西,我在我的xib中添加了一個普通的標準UITableView,連接了數據源和委託並從-tableView:cellForRowAtIndexPath:返回了一個常規的UITableViewCell,

我在網上搜索了一個也沒有工作的普通工具-layoutSubviews

有什麼我不得不在我的子類中實現?

回答

0

後搜索,而不是在互聯網上找到任何東西的時間,我做了一整天的反覆試驗,找出在我XIB的Editing設置爲Multiple Selection During Editing

我不知道這會禁用「輕掃即刪除功能」。

,因爲我需要這兩種可能性(S2D除非編輯和多選在編輯時)我在-toggleEditing:方法添加以下兩行:

if(![_tableView isEditing]) { 
    [_tableView setAllowsMultipleSelectionDuringEditing:YES]; // <---- 
    [_tableView setAllowdSelectionDuringEditing:YES];   // <---- 
    [_tableView setEditing:YES animated:YES]; 
} 
else { 
    [_tableView setAllowsMultipleSelectionDuringEditing:NO];  // <---- 
    [_tableView setAllowdSelectionDuringEditing:NO];    // <---- 
    [_tableView setEditing:NO animated:YES]; 
} 
相關問題