在我的应用程序中,如果位置服务处于关闭状态,它会提示用户:打开位置服务以允许“MyAPP”确定您的位置。iOS CLLocationManager打开位置服务
两个选项按钮是设置和取消。
当用户按下取消按钮时如何处理?
是否有任何delgate方法来处理取消按钮按?
在我的应用程序中,如果位置服务处于关闭状态,它会提示用户:打开位置服务以允许“MyAPP”确定您的位置。iOS CLLocationManager打开位置服务
两个选项按钮是设置和取消。
当用户按下取消按钮时如何处理?
是否有任何delgate方法来处理取消按钮按?
也许这可能适用于你想要的。
首先,符合头文件中的UIAlertViewDelegate协议。
然后有一个你可以实现的委托方法。 //通过UIAlertView中按钮名称
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
// if the alert view that appeared has titled "Location Denied" and user pressed on cancel button (cancel button is button at index 0)
if(alertView.title isEqualToString:@"Location Denied"] && buttonIndex == 0)
{
// do something
}
}
你可以访问你按下哪个按钮*
- (空)alertView:(UIAlertView中*)alertView clickedButtonAtIndex:(NSInteger的)buttonIndex
{
NSString * title = [alertView buttonTitleAtIndex:buttonIndex];
如果([标题isEqualToString:@ “取消”])
{
}
}
你不能做任何东西,除了显示这样的消息: “您需要启用定位服务,才能使用blablabla” 。 – aforaudrey 2012-08-15 19:18:37