Very slowly loading a standard text message viewer

I have a simple code that loads a standard text message controller.

Very slowly presenting a presentation for the first time. As soon as it loads, the first time after it is reloaded it will not take much time. Can I do something to speed up the process?

- (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]; } } 
+4
source share
1 answer

One way to solve this problem is to preload the MFMessageComposeViewController .

It depends on how your application is organized, but you can make controller a property corresponding viewcontroller (or, perhaps, appDelegate , some will argue with it).

So you would call:

 self.controller = [[MFMessageComposeViewController alloc] init]; 

somewhere in viewDidLoad or applicationDidFinishWithLaunching ...

Then you just introduce the controller if necessary.

NOTE. This is not exactly a memory based approach.

+7
source

Source: https://habr.com/ru/post/1399811/


All Articles