My app loads 5 UIButton
(2 of which use custom images), a UITextView
and a UITextField
on the main thread as reaction to a button press. Testing on an iPad 2 this takes a few seconds, but only the first time. After that, even after releasing everything, it loads a lot faster. To me it seems like the iPad first has to free some inactive memory in order to be able to load my stuff. Can I somehow request more memory at my disposal in advance to speed things up a little?
SOLUTION: As the problem was caused by the keyboard, this is the solution that worked best for me:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Preloads keyboard so there's no lag on initial keyboard appearance.
UITextField *lagFreeField = [[UITextField alloc] init];
[self.window addSubview:lagFreeField];
[lagFreeField becomeFirstResponder];
[lagFreeField resignFirstResponder];
[lagFreeField removeFromSuperview];
}
I also delayed the adding of my RootView a little so the lag does not mess up animations I have going on there in the beginning.