[英]iOS 7 : How to change the status bar text color as white in one view controller and black in second view controller?
[英]How to redirect to a view controller based on the status of location services in iOS
我正在使用以下代码检查用户的应用程序位置服务是否已更改。 如果他们改变,他们应该查看不同的视图控制器。 它实际上只需要在每次启动应用程序时运行,然后根据[CLLocationManager authorizationStatus]
状态重定向
我的代码的问题是每次位置更新时都会运行segue。
谢谢你的帮助
- (void)locationUpdate:(CLLocation *)location {
//locLabel.text = [location description];
NSLog(@"auth status is %u", [CLLocationManager authorizationStatus]);
if ([CLLocationManager authorizationStatus] == kCLAuthorizationStatusAuthorized) {
[self performSegueWithIdentifier: @"SegueOffersGPS" sender: self];
} else {
[self performSegueWithIdentifier: @"SegueOffersNoGPS" sender: self];
}
如果要停止更新位置,请写下面的代码
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
{
[self.locationManger stopUpdatingLocation];
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.