Tom
Tom

Reputation: 4662

ios 7.1 - UIDatePicker will bring View appear lag

Here it is. I created an UITableView in current controller, and it's static cell type. When I touched the button, will push this controller to UINavigationController, I found that it will take 3s delay to open, that's slow, sometimes we will think that we didn't touch the button correctly, kind bad UX.

So I tried Time Profile Tool and saw it invoke Calendar library, I tried to remove these two UIDatePicker from UITableView, and try it again, yes it's quick as its used to be around 1s.

So the question is how to remove this delay while it's still loading UIDatePicker in it?

enter image description here

Upvotes: 1

Views: 758

Answers (2)

moh.ABK
moh.ABK

Reputation: 28

Loading that many UIDatePickers via Storyboard is sure to slow down your navigation.

  • Create your UIDatepicker(s) programmatically
  • If you need to pass data from the picker as the view appears create in viewWillAppear
  • If you don't need any data from them until the view has been loaded create in viewDidAppear

My application required data on display so I created mine in viewWillAppear

Upvotes: 1

Tom
Tom

Reputation: 4662

Solved.

  1. Remove UIDatePicker from UITableView
  2. Created UIDatePicker programmatically in viewDidAppear

Then its energy back.

Upvotes: 0

Related Questions