if([MFMessageComposeViewController canSendText])
{
MFMessageComposeViewController *sms_message_vc = [[MFMessageComposeViewController alloc] init];
sms_message_vc.body = text;
sms_message_vc.recipients = recipients;
sms_message_vc.messageComposeDelegate = self;
[self presentModalViewController:sms_message_vc animated:FALSE];
[[UIApplication sharedApplication] setStatusBarHidden:TRUE];
[sms_message_vc release];
}
When this is done there, there is a delay of a few seconds until the layout view is actually displayed. What causes this and how is the delay eliminated?
EDIT 1: Clarification: creating sms_message_vcand ivar does not help, because the process ...alloc] init]will hang on the user interface for several seconds, regardless of where it is located.
EDIT 2: Tried GCD (with different priorities) to try to start initialization at the same time. Did not help:
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, (unsigned long)NULL), ^(void){
sms_message_vc = [[MFMessageComposeViewController alloc] init];
sms_message_vc.messageComposeDelegate = self;
});
source
share