2016-09-28 2 views

답변

4

당신은 delegate 방법을 구현해야합니다 (-) 모든 세포에 대한 기호를

self.yourTableView.setEditing(true, animated: true) 

당신이 버튼의 클릭에 할 수있는

func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) 
{ 

    // below code will delete one row - you can mange another kind of deletion here like delete from database also 
    if editingStyle == .Delete 
    { 
     yourDataArray.removeAtIndex(indexPath.row) 
     self.yourTableView.reloadData() 
    } 
} 

그리고

일 등, 보여!

+1

@aldo 또한 버튼을 나타 내기 위해 셀을 스 와이프 할 수있는'editActionsForRowAtIndexPath'를 확인해 볼 수 있습니다. – GoodSp33d

+0

예! 질문자는'editActionsForRowAtIndexPath'도 살펴 봐야합니다 !! @ GoodSp33d – Lion

+0

@ GoodSp33d (-) 버튼을 탭하면 셀을 스 와이프하여 삭제 버튼을 표시하고 싶습니다. –