Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Very slow to load standard text message view controller

Tags:

iphone

ios5

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];
}
}
like image 730
rs2000 Avatar asked Mar 05 '12 15:03

rs2000


1 Answers

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.

like image 151
Rok Jarc Avatar answered Nov 05 '22 19:11

Rok Jarc