【发布时间】:2012-10-25 16:14:58
【问题描述】:
我的应用程序中有此代码:
if (self.uiSwtichState == TRUE)
{
if ([CLLocationManager locationServicesEnabled])
{
[self.textString stringByAppendingString:[[[SMSLocationModel alloc] init] getLocation]];
}
}
MFMessageComposeViewController *sms = [[MFMessageComposeViewController alloc] init];
sms.messageComposeDelegate = self;
sms.body = self.textString;
sms.recipients = self.arrayOfNumbers;
[self presentModalViewController:sms animated:YES];
这段代码被放入一个名为“send”的方法中。 可以想象,getLocation 方法获取当前用户位置,并且在应用程序第一次运行时,屏幕上会出现一个 UIAlertView,询问用户是否允许应用程序获取他的位置。 问题是当这个 UIAlertView 出现时,她立即被短信 Vie Controller (MFMessageComposeViewController) 取代,这样用户就没有足够的时间在 UIAlertView 中回答 YES 或 NO。
有一种方法可以等待用户按下 UIAlertView 中的按钮,然后呈现 ModalViewController?
谢谢!
【问题讨论】:
标签: iphone objective-c location uialertview wait