Unable to set frame correctly before viewDidAppear

后端 未结 3 1424
悲&欢浪女
悲&欢浪女 2020-11-30 22:45

I was wondering if anyone knows why when you set the frame of a subview in viewDidLoad and viewWillAppear the changes do not take affect on the scr

3条回答
  •  忘掉有多难
    2020-11-30 23:10

    in viewWillAppear()

    just call layoutIfNeeded() once for the view whose frame you want to get.

    if tableView then tableView.layoutIfNeeded() for exmple

提交回复
热议问题