Я использую методПроблема с методом tableview func tableView (tableView: UITableView, editActionsForRowAtIndexPath indexPath: NSIndexPath) -> [UITableViewRowAction]?
func tableView(tableView: UITableView, editActionsForRowAtIndexPath indexPath: NSIndexPath) -> [UITableViewRowAction]?
{
let delete = UITableViewRowAction(style: UITableViewRowActionStyle.Default, title: "Delete" , handler: { (action:UITableViewRowAction!, indexPath:NSIndexPath!) -> Void in
//Do something
})
delete.backgroundColor = UIColor.redColor()
let more = UITableViewRowAction(style: UITableViewRowActionStyle.Default, title: "More" , handler: { (action:UITableViewRowAction!, indexPath:NSIndexPath!) -> Void in
//Do something
})
more.backgroundColor = UIColor.blueColor()
return [delete, more]
}
Я также включил
func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) {
// you need to implement this method too or you can't swipe to display the actions
}
func tableView(tableView: UITableView, canEditRowAtIndexPath indexPath: NSIndexPath) -> Bool {
// the cells you would like the actions to appear needs to be editable
return true
}
и когда я красть вправо или влево кнопки я создал не отображаются. Я попытался положить переопределить на editactionforrowindexpath, но затем я получаю ошибку, говоря, что метод не отменяет какой-либо метод из его суперкласса
поставить точку останова и проверить его функцию называется или нет ? если нет, то проверьте, правильно ли установлен ваш делегат или нет! – Pushp
im используя uitableviewdelegate и uitabledatasource, и функция не называется im, не уверен, почему @Pushp –
вы уже установили? Если да ? тогда как? proragetically или с помощью storyboadrd? – Pushp