performSegueWithIdentifier very slow when segue is modal

后端 未结 8 1746
天命终不由人
天命终不由人 2020-12-01 04:58

I have a simple table view where I handle the select action on the table view. This action follows a segue.

If the segue is a push segue, the next view

8条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-01 05:30

    It seems (to me...) that this problem happens only when the cell selectionType is not .none.

    You may change it to any other option (at the storyboard Attribute inspector, set the Selection field) and it will work fine (working for me...). The cons is that it messing up the cell UI.

    You can call the segue in DispatchQueue.main.async{} block at the didSelect delegate function of UITableViewDelegate as people mention before.

    I used the first solution and added at the cell itself -

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(false, animated: false)
    }
    

    This will make the cell 'highlight' at the tap, but it will return to its usual UI immediately and it fine for me...

提交回复
热议问题