2016-01-20 83 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] 
} 
相关问题