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];
}
执行此操作时,在实际显示撰写视图之前会有几秒钟的延迟。是什么导致了这种情况,如何消除延迟?
编辑 1:澄清:制作sms_message_vc
和 ivar 无济于事,因为该...alloc] init]
过程会将 UI 挂起几秒钟,无论它在哪里。
编辑2:尝试GCD(具有不同的优先级)尝试同时运行初始化。没有帮助:
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;
});