UITableView in edit mode - 'Edit' button doesn't change status

前端 未结 3 946
自闭症患者
自闭症患者 2021-02-08 04:41

I have a UIViewController class, with a tableView. In viewDidLoad:

UIBarButtonItem *editIcon = [[[UIBarButtonItem alloc]
initWithBarButtonSystemItem: UIBarButton         


        
3条回答
  •  北恋
    北恋 (楼主)
    2021-02-08 05:30

    It's because you're only setting the style of the button (not its text) when you switch modes. You need to do this (or equivalent):

    -(void)toggleEditMode{
        self.navigationItem.rightBarButtonItem.title = self.tableView.editing ? @"Done" : @"Edit";
    

提交回复
热议问题