I have the following viewDidLoad
method:
- (void)viewDidLoad {
NSLog(@"didLoad");
if (self.loginField.text.length > 0) [self.passwordField becomeFirstResponder];
else [self.loginField becomeFirstResponder];
}
I also add log times in viewWillAppear
and viewDidAppear
.
There are some situations when push animation takes much time. I have measured the time with commented (and without) if-else lines (see: the times are shown below). I don't know what can slow down my app between viewWillAppear
and viewDidAppear
calls.
I tried to anayze this fragment of code with Time Profiler (Instruments), but it shows nothing. I have no clue what should I do, to show my view faster. Any ideas?
With becomeFirstResponder, first call
2014-07-11 16:51:41.090 didLoad
2014-07-11 16:51:41.133 willAppear
2014-07-11 16:51:44.223 did appear
diffAppear = 3090ms
With becomeFirstResponder, second call
2014-07-11 16:52:01.370 didLoad
2014-07-11 16:52:01.400 willAppear
2014-07-11 16:52:02.109 did appear
diffAppear = 709ms
Without becomeFirstResponder, first call
2014-07-11 16:57:21.720 didLoad
2014-07-11 16:57:21.754 willAppear
2014-07-11 16:57:22.420 did appear
diffAppear = 666ms
Without becomeFirstResponder, second call
2014-07-11 16:57:31.851 didLoad
2014-07-11 16:57:31.870 willAppear
2014-07-11 16:57:32.541 did appear
diffAppear = 671ms