开发者

UIAlertView conditional statmenst (if else??)

I'm new to coding and was wondering how I might be able to set a conditional statement for an alert message. So I have this so far:

mapView.showsUserLocation = YES; 

NSString *title = [[NSString alloc] initWithFormat:
                   @"Alert"];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle: title message: @"I would like to use your location." delegate:self cancelButtonTitle:@"Allow" otherBut开发者_StackOverflowtonTitles:@"Don't Allow", nil];

Basically I want to put an if else statement in. if allow is selected, run showuserlocation... else NO.

How can I do that?

Thanks...


Don't do this yourself. Just run your showUserLocation method. The user will automatically be prompted to allow the app to access details about their current location, if they haven't already granted permission for your app.

The OS does this for you, as soon as your app attempts to access any location-based features.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜