I have some simple code that loads the standard text message controller.
It is very slow to present the view for the first time. Once it is loaded the first time subsequent loading it again does not take long. Is there anything I can do to speed things up ?
- (IBAction)actionSMS:(id)sender {
MFMessageComposeViewController *controller = [[MFMessageComposeViewController alloc] init];
controller.messageComposeDelegate = self;
if([MFMessageComposeViewController canSendText])
{
controller.body = self.MessageDetail.text;
[self presentModalViewController:controller animated:YES];
}
}
One way of solving this would be preloading MFMessageComposeViewController
.
It depends how your app is organised but you could make controller
a property
of appropriate viewcontroller
(or maybe appDelegate
, some will argue with that).
So you would call:
self.controller = [[MFMessageComposeViewController alloc] init];
somewhere in viewDidLoad
or applicationDidFinishWithLaunching
...
You then simply present the controller
when needed.
NOTE: this is not exactly a memory-friendly approach.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With