Delay in presenting a modal view controller

前端 未结 9 1871
星月不相逢
星月不相逢 2020-12-24 10:51

I have a tab bar based app. There are navigation controllers in all 5 tabs with instances of custom view controller setup properly as root view controllers. This loads just

9条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-24 11:30

    The common problem with this behaviour is as follows:

    one sets selectionStyle = .none for a cell in the tableView (it seems that it doesn't depend on UITableViewController subclassing as was written at http://openradar.appspot.com/19563577) and uses at the delegate method

    override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath)
    

    animating deselect

    tableView.deselectRow(at: indexPath, animated: true)
    

    which implies animation for non-animating cell.

    In this case the subsequent view controller presentation has a delay.

    There are some workaround solutions including dispatch_async on main thread, but it is better not to call deselectRow even without animation on unselectable cells in your code.

提交回复
热议问题