Home  >  Q&A  >  body text

objective-c - ios页面跳转有点卡顿

其中一个ViewController执行以下语句

UIViewController *vc = [[UIViewController alloc] init];
[self.navigationController pushViewController:vc animated:false];

将要被push的ViewController的viewDidLoad方法中,我init了一个textview和一个button,并且addSubview了,然后我在viewWillAppear方法中设置了他们的一点属性,用Masonry做了布局。
然后在第一次push的时候会产生卡顿,请问有什么方法避免?

PHP中文网PHP中文网2741 days ago710

reply all(12)I'll reply

  • PHP中文网

    PHP中文网2017-04-18 09:17:45

    If the background color is not set (that is, the default background color), there may be lags. Try setting it to white. In addition, it may also be due to data binding that causes the view to be displayed only after the loading is completed. This should be called slow loading

    reply
    0
  • 巴扎黑

    巴扎黑2017-04-18 09:17:45

    Since you have not posted the source code, you can refer to this batch of articles http://www.cocoachina.com/industry/20140114/7696.html
    to conduct performance analysis and find out the cause of the lag.

    reply
    0
  • Cancelreply