2016-01-20 50 views
-1

在Objective-C,如何在Swift中的UITableView editingStyleForRowAtIndexPath函數中返回多值?

- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    return UITableViewCellEditingStyleDelete | UITableViewCellEditingStyleInsert; 
} 

這項工作, 我怎麼能轉換成斯威夫特?

+0

你在做什麼是無效的。 'UITableViewCellEditingStyle'是一個枚舉。這不是一個掩碼。你只應該返回一個單一的值。此外,這意味着一行應該在單元左側的同一位置顯示綠色+和紅色圖標? – rmaddy

回答

0

試試這個:

func tableView(tableView: UITableView, editingStyleForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCellEditingStyle { 
    return [.Delete, .Insert] 
} 
相關問題