2015-04-17 76 views
4

iOS8現在提供了一種用動作創建可滑動表格視圖單元格的方法。在Apple自己的郵件應用程序中,如果您一直拖動單元格,則還可以提交默認操作(如果您一直拖動並釋放,郵件應用程序會顯示更多|標記|垃圾箱和默認垃圾箱)。有沒有辦法在iOS 8中做到這一點?具有默認操作的可滑動表格視圖單元

+0

其中蘋果的應用程序,你指什麼?所以我們可以得到你的意思的參考。 –

+0

您是否在討論郵件應用程序如何一路滑動? – Oxcug

+0

@BenKane郵件應用程序 - 它顯示更多|標誌|垃圾箱,如果您一直拖動並釋放,則會執行垃圾箱操作。 – Boon

回答

0

如果你指的是滑動刪除對TableViews您可以使用此代碼:

//Enable multiple selections during editing 
self.tableView.allowsMultipleSelectionDuringEditing = NO; 

//Enable editing row 
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath { 
// Return YES if you want the specified item to be editable. 
return YES; 
} 

//Do something on delete 
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath { 
if (editingStyle == UITableViewCellEditingStyleDelete) { 
    //add code here for when you hit delete 
}  
} 
0

什麼你要找的是不是公共API中呢。幸運的是,有人已經做跑腿:)

JASwipeCell

相關問題