IOS之地图和定位应用开发
<div id="cnblogs_post_body">11.1 iOS定位服务11.2 iOS地图
11.3 Web地图
11.1 iOS定位服务
iOS中有三个定位服务组件:
Wifi定位,通过查询一个Wifi路由器的地理位置的信息。比较省电,iPod touch和iPad也可以采用。
蜂窝基站定位,通过移动运用商基站定位。也适合有3G版本的iPod touch和iPad。
GPS卫星定位,通过3-4颗GPS定位位置定位,最为准确,但是耗电量大,不能遮挡。
Core Location
Core Location是iPhone、iPad等开发定位服务应用程序的框架。我们要在Xcode中添加&ldquo;CoreLocation.framework&rdquo;存在的框架。
主要使用的类是:CLLocationManager,通过CLLocationManager实现定位服务。
CoreLocation.framework
定位服务实例
http://images.cnblogs.com/cnblogs_com/syxchina/201210/201210142259195374.png
项目WhereAmI:
WhereAmIViewController.h
<div class="cnblogs_code">#import <UIKit/UIKit.h>#import <CoreLocation/CoreLocation.h>@interface ViewController : UIViewController<CLLocationManagerDelegate> { CLLocationManager* locationManager;}@property (strong, nonatomic) CLLocationManager* locationManager;@property (retain, nonatomic) IBOutlet UILabel *longitudeText;@property (retain, nonatomic) IBOutlet UILabel *latituduText;@property (retain, nonatomic) IBOutlet UIActivityIndicatorView *activity;- (IBAction)findMe:(id)sender;- (IBAction)webMap:(id)sender;@end
页:
[1]