0
我想檢查位置服務已啓用或禁用我的應用程序。因此,如果位置服務被禁用,我會發出不同的看法。我怎樣才能使用一個故事板來做到這一點?我需要一個示例代碼。如何查看位置服務並啓動不同的視圖?
Segue公司標識(例如GPS視圖的):
我的代碼:
- (void)viewDidLoad
{
[super viewDidLoad];
if([CLLocationManager locationServicesEnabled]){
NSLog(@"Konum Servisleri Açık");
if([CLLocationManager authorizationStatus]==kCLAuthorizationStatusDenied){
alert = [[UIAlertView alloc] initWithTitle:@"Konum Servisleri Kapalı" message:@"Etkinleştirmek için ayarlardan konum servislerini kullanmasına izin verin." delegate:nil cancelButtonTitle:@"Tamam" otherButtonTitles:nil];
[alert show];
segueKontrol = @"Normal";
[self performSegueWithIdentifier:@"Normal" sender:self];
}
else{
segueKontrol = @"GPS";
[self performSegueWithIdentifier:@"GPS" sender:self];
}
}
else{
NSLog(@"Konum Servisleri Kapalı");
alert = [[UIAlertView alloc] initWithTitle:@"Konum Servisleri Kapalı" message:@"Etkinleştirmek için ayarlardan Konum Servislerini etkinleştirin." delegate:nil cancelButtonTitle:@"Tamam" otherButtonTitles:nil];
[alert show];
segueKontrol = @"Normal";
[self performSegueWithIdentifier:@"Normal" sender:self];
}
// Do any additional setup after loading the view, typically from a nib.
}
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{
if ([[segue identifier] isEqualToString:@"Normal"])
{
CCHop2ViewController *cc = [segue destinationViewController];
}
else{
CCHopViewController *cc = [segue destinationViewController];
}
}
它不起作用,什麼也沒有發生。查看無法啓動。 – 2013-03-14 09:44:48
確保您在故事板中正確命名您的segues。 – Rikkles 2013-03-14 09:56:55
我編輯了我的問題。 – 2013-03-15 08:20:08