iOS Dev (35) CoreLocation 获取经纬度
来源:互联网 发布:云计算的定义是什么 编辑:程序博客网 时间:2024/06/05 16:18
iOS Dev (35) CoreLocation 获取经纬度
- 作者:大锐哥
- 博客:http://blog.csdn.net/prevention
AppDelegate.h
#import <UIKit/UIKit.h>@interface AppDelegate : UIResponder <UIApplicationDelegate>@property (strong, nonatomic) UIWindow *window;@end
AppDelegate.m
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{ self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; LocationViewController *lvc = [[LocationViewController alloc] init]; self.window.rootViewController = lvc; [self.window makeKeyAndVisible]; return YES;}
LocationViewController.h
#import <UIKit/UIKit.h>#import <CoreLocation/CoreLocation.h>@interface LocationViewController : UIViewController <CLLocationManagerDelegate>@property (strong, nonatomic) CLLocationManager *mgr;@end
LocationViewController.m
#import "LocationViewController.h"@interface LocationViewController ()@end@implementation LocationViewController-(void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations{ CLLocation *newLocation = [locations lastObject]; CLLocation *oldLocation; if (locations.count > 1) { oldLocation = [locations objectAtIndex:locations.count-2]; } else { oldLocation = nil; } NSLog(@"didUpdateToLocation %@ from %@", newLocation, oldLocation);}- (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error{ NSLog(@"%@",error);}- (void)viewDidLoad{ [super viewDidLoad]; self.mgr = [[CLLocationManager alloc] init]; self.mgr.delegate = self; self.mgr.desiredAccuracy = kCLLocationAccuracyBest; self.mgr.distanceFilter = 5.0; [self.mgr startUpdatingLocation];}- (void)didReceiveMemoryWarning{ [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated.}@end
-
转载请注明来自大锐哥的博客:http://blog.csdn.net/prevention
0 0
- iOS Dev (35) CoreLocation 获取经纬度
- iOS, corelocation定位经纬度坐标,以及经纬度距离
- ios获取当前经纬度
- iOS 获取当前经纬度
- iOS 获取当前经纬度
- iOS获取当前位置经纬度
- iOS经纬度获取
- iOS获取经纬度
- iOS获取当前经纬度
- iOS系统获取经纬度
- iOS --- 使用CoreLocation来获取地理位置信息
- IOS CoreLocation
- IOS CoreLocation
- IOS CoreLocation
- IOS-corelocation
- 在IOS 8 iOS 9 中使用CoreLocation 获取地理位置
- ios获取所在地的经纬度
- iOS 之获取地图经纬度
- OSX:通过代理/802.1x认证网络恢复系统的一个方法
- Naive Bayes(c++)源代码下载
- 二分类 度量可分类程度指标Hindex IN ,matlab
- Cracking the coding interview--Q1.5
- 程序开发感悟二
- iOS Dev (35) CoreLocation 获取经纬度
- Android 解决ScrolView嵌套GridView冲突问题
- 走进小作坊(五)----Facebook效应
- ssl协议学习
- 关于struts2的json配置错误
- 【设计模式基础】行为模式 - 4 - 命令(Command)
- Cracking the coding interview--Q1.6
- A Gentle Introduction to Markov Chain Monte Carlo (MCMC)
- 黑马程序员_Java基础_多线程_12