iOS 9: Frame no longer set in viewWillAppear after UINavigationController pushViewController

前端 未结 4 1242
我寻月下人不归
我寻月下人不归 2020-12-15 07:32

I\'m trying to solve a view placement bug that has arisen as of iOS 9. I am instantiating a view controller from a xib file (non-autolayout) and then pushing this onto my

4条回答
  •  借酒劲吻你
    2020-12-15 07:51

    A little bit updated NickProvost's answer:

    private var loadViewToken: dispatch_once_t = 0
    
    override func viewDidLayoutSubviews() {
        super.viewDidLayoutSubviews()
        dispatch_once(&loadViewToken) { [weak self] in
            if let wSelf = self {
                wSelf.setupView()
            }
        }
    }
    

提交回复
热议问题