I'm trying to make a app that has a MKMapView, and you can turn on/off whether it shows your location or not. I'm using a UIActionSheet to let the user decide to turn it showsUserLocation on/off. The problem is not the UIActionSheet, but that I can't seem to get the MKMapView to display the user location when I select the YES option.
Code in the - (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
Method:
// Show User Location ActionSheet
if (actionSheet.tag == 1) {
// YES Button
if (buttonIndex == 0) {
MapView.showsUserLocation = YES;
}
// NO Button
if (buttonIndex == 1) {
MapView.showsUserLocation = NO;
}
}
It's not showing the User's Location, even though I press the YES button. Help please?!?!
Never mind, I found a video that helped me a lot!
http://www.youtube.com/watch?v=KTDXzYzIhVI
This tutorial on YouTube helped me display the user's location on the MKMapView. Turns out that in the - (void)viewDidLoad
Method, I needed to add [MapView setDelegate:self];
. Boy, that was a stupid mistake! :P