ios8下地图ios8定位服务有哪些改变

您的位置: >
iOS8自带地图怎么放置大头针
  iPhone日益成为满大街随处可见的手机,苹果手机的功能也越来越强大,今天小编就为大家介绍一个iOS8系统自带地图如何防止大头针的技巧。  苹果在iOS8系统提供了地图应用,方便大家日常使用。在日常使用地图时,有时需要对一些地点进行标注,留作记号,便于下次查看。在iOS8系统自带的地图中,用户可以使用大头针来进行标记。具体操作方法如下:  第一步,进入地图应用后,长按地图中需要标记的位置,即可放置大头针。  第二步,放置大头针后,即可看到该位置的标记。  第二步,点击该标记,即可进行查看该处的详细地址、路线规划及看街景地图,还可以创建新联系人等。
最近软件更新iOS8自带地图大头针使用技巧_iTunes之家
iOS8自带地图大头针使用技巧
时间:日 | 关键字: | 来源:
  iPhone是苹果公司推出的智能手机,精美的外形和智能化的功能,深得不少果粉的喜爱,已成为比较流行的街机。为方便大家了解和熟悉iPhone功能和技巧,苹果园特别推出iPhone&每日一技&专栏。下面为大家介绍iOS8自带地图放置大头针技巧。
  苹果在iOS8系统提供了地图应用,方便大家日常使用。在日常使用地图时,有时需要对一些地点进行标注,留作记号,便于下次查看。在iOS8系统自带的地图中,用户可以使用大头针来进行标记。具体操作方法如下:
  第一步,进入地图应用后,长按地图中需要标记的位置,即可放置大头针。
  第二步,放置大头针后,即可看到该位置的标记。
  第二步,点击该标记,即可进行查看该处的详细地址、路线规划及看街景地图,还可以创建新联系人等。关于麦子学院ios地理位置及定位系统最后一个导航应用的(ios8-&9)修改 - 简书
下载简书移动应用
写了3767字,被0人关注,获得了1个喜欢
关于麦子学院ios地理位置及定位系统最后一个导航应用的(ios8-&9)修改
我先废话一下下,一代学渣君。最近要期末啦。木有时间学习ios啦。import UIKitimport MapKitclass ViewController: UIViewController ,MKMapViewDelegate {var startField:UITextField!//出发地var deretField:UITextField!//目的地var nav:UIButton!//导航开启var _mapView:MKMapView!var _startLocation:CLLocation!//出发点位置信息var _dereLocation:CLLocation!//目的地位置信息var ge:CLGeocoder!//反编码管理类var NavPath:MKPolyline! //导航线路var startMark:CLPlacemark! //出发点的相关信息override func viewDidLoad() {super.viewDidLoad()self .loadMapView()self.initSubViews()// Do any additional setup after loading the view, typically from a nib.}func loadMapView(){_mapView = MKMapView(frame: self.view.bounds)_mapView.mapType = MKMapType.Standard_mapView.zoomEnabled = true_mapView.scrollEnabled = true_mapView.rotateEnabled = true_mapView.delegate = selfself.view.addSubview(_mapView)self.locateToLatitudeAndLongtitude(22., longti: 113.9663327)}func initSubViews(){let scrennWidth = UIScreen.mainScreen().bounds.size.widthvar scrennheight = UIScreen.mainScreen().bounds.size.heightstartField = UITextField(frame: CGRectMake((scrennWidth
- 200) / 2 , 30, 200, 25))deretField = UITextField(frame: CGRectMake((scrennWidth
- 200) / 2 , 60, 200, 25))startField.borderStyle = UITextBorderStyle.RoundedRectderetField.borderStyle = UITextBorderStyle.RoundedRectstartField.becomeFirstResponder()startField.placeholder = "输入出发地"deretField.placeholder = "输入目的地"startField.font = UIFont.systemFontOfSize(13)deretField.font = UIFont.systemFontOfSize(13)self.view.addSubview(startField)self.view.addSubview(deretField)nav = UIButton(frame: CGRectMake(startField.frame.origin.x + startField.frame.size.width + 10, 45, 60, 20))nav.layer.borderWidth = 0.5nav.layer.borderColor = UIColor.blackColor().CGColornav.layer.cornerRadius = 4.0nav.titleLabel?.font = UIFont.systemFontOfSize(13)nav.setTitleColor(UIColor.blackColor(), forState: UIControlState.Normal)nav.setTitle("开始导航", forState: UIControlState.Normal)nav.addTarget(self, action: "startNavgation:", forControlEvents: UIControlEvents.TouchUpInside)self.view.addSubview(nav)}func locateToLatitudeAndLongtitude(lat:Double , longti:Double){let coor:CLLocationCoordinate2D = CLLocationCoordinate2D(latitude: lat, longitude: longti)let sp:MKCoordinateSpan = MKCoordinateSpan(latitudeDelta: 0.5, longitudeDelta: 0.5)let re:MKCoordinateRegion = MKCoordinateRegion(center: coor, span: sp)_mapView.setRegion(re, animated: true)}func startNavgation(senser:UIButton){startField.resignFirstResponder()deretField.resignFirstResponder()//失去第一响应if startField.text == nil || deretField.text == nil || startField.text == "" || deretField.text == ""{let aler:UIAlertView = UIAlertView(title: "提示", message: "出发地或者目的地无效", delegate: nil, cancelButtonTitle: "ok")aler.show()return}self.codeerWithString(startField.text!)//开启起始点编码}func codeerWithString(address:NSString){ge = CLGeocoder()//初始化ge.geocodeAddressString(address as String) { ( placemarks:[CLPlacemark]?, error:NSError?) -& Void inif
placemarks!.count & 0
//实际操作中 这里需要筛选处理{var pl:CLPlacemark = placemarks![0] as! CLPlacemarkif address == self.startField.text{self._startLocation = pl.location! as CLLocation //保存好编码后的位置信息var an:MKPointAnnotation = MKPointAnnotation()an.coordinate = pl.location!.coordinatean.title = "出发点"self._mapView.addAnnotation(an)//添加大头针self.startMark = pl //placeMark信息保留self.locateToLatitudeAndLongtitude(self._startLocation.coordinate.latitude, longti: self._startLocation.coordinate.longitude)self.codeerWithString(self.deretField.text!)//开启目的地位置编码}else{self._dereLocation = pl.location! as CLLocation //保存好编码后的位置信息var an:MKPointAnnotation = MKPointAnnotation()an.coordinate = pl.location!.coordinatean.title = "目的地"self._mapView.addAnnotation(an)//添加大头针/**************走到这里 位置信息编码结束****************/self.startNavagationWithMark(pl)//启动导航}}}}//
func startNavagationWithMark(markL:CLPlacemark)//
_mapView.removeOverlay(self.NavPath)//移除上次定位线路//这个不能放在这里,应该删掉否则线程报错,私人认为是你刚启动应用的适合,没有上次定位路线,由于在这里没有用coredata什么的,后台走了,就自动还原成刚开始,没有存储数据。(我直接删掉,成功啦。)////
var request:MKDirectionsRequest = MKDirectionsRequest()//初始化一个导航请求////////
request.setSource = self.getAItemWithMark(startMark)//设置源头.出发点//////
//设置目的地//
request.setDestination = self.getAItemWithMark(markL)//
//通过request 创建一个响应头//
var mkdirection:MKDirections = MKDirections(request: request)////
mkdirection.calculateDirectionsWithCompletionHandler { (response:MKDirectionsResponse!, err:NSError!) -& Void in////
//查询返回的第一条路线//
var route:MKRoute = response.routes[0] as MKRoute//
//保存路线//
self.NavPath = route.polyline//
//添加到地图//
self._mapView.addOverlay(self.NavPath, level: MKOverlayLevel.AboveLabels)//////
}func startNavagationWithMark(markL:CLPlacemark){let request:MKDirectionsRequest = MKDirectionsRequest() //初始化一个导航请求//
self.getAItemWithMark(startMark)//
request.setSource(self.getAItemWithMark(startMark))//上面就是原来的,下面是我改得版本,我进入到类里面看了,原来是已经取消了set,get方法,就直接用.赋值就行request.source = self.getAItemWithMark(startMark)//设置源头,出发点request.destination = self.getAItemWithMark(markL)
//设置目的地let mkdirection:MKDirections = MKDirections(request: request)//通过request创建一个响应头mkdirection.calculateDirectionsWithCompletionHandler { (response:MKDirectionsResponse?, err:NSError?) -& Void in//查询返回的第一条路线var route:MKRoute = (response?.routes[0])! as MKRoute//保存路线self.NavPath = route.polylineself._mapView.addOverlay(self.NavPath, level: MKOverlayLevel.AboveLabels)}//
_mapView.removeOverlay(self.NavPath)//移除上一次定位的线路,刚开始的时候,,木有。}func getAItemWithMark(mark:CLPlacemark) -& MKMapItem{//通过CLPlaceMark创建一个MKPlaceMarklet mkp:MKPlacemark = MKPlacemark(placemark: mark)//通过MKP 创建 MKtemlet item:MKMapItem = MKMapItem(placemark: mkp)return item}func mapView(mapView: MKMapView, rendererForOverlay overlay: MKOverlay) -& MKOverlayRenderer! {//创建一个renderlet naRende:MKPolylineRenderer = MKPolylineRenderer(polyline: overlay as! MKPolyline)//设置路线图线条颜色naRende.strokeColor = UIColor.redColor()naRende.lineWidth = 5.0return naRende}func mapView(mapView: MKMapView, viewForAnnotation annotation: MKAnnotation) -& MKAnnotationView! {let identy:NSString = "identy"var pinView:MKPinAnnotationView? = mapView.dequeueReusableAnnotationViewWithIdentifier(identy as String) as? MKPinAnnotationViewif
nil == pinView{pinView = MKPinAnnotationView(annotation: annotation, reuseIdentifier: identy as String)}if
annotation.title! == "出发点"{//大头针的颜色为绿色pinView?.pinColor = MKPinAnnotationColor.Green}else{//大头针的颜色为红色pinView?.pinColor = MKPinAnnotationColor.Red}return pinView}override func didReceiveMemoryWarning() {super.didReceiveMemoryWarning()// Dispose of any resources that can be recreated.}}也就几个小错而已,我承认这些错误非常白痴,但是。我反正很开心自己解决bug啦。。
如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!
打开微信“扫一扫”,打开网页后点击屏幕右上角分享按钮
如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!
选择支付方式:ios8下地图定位有哪些改变_百度知道
ios8下地图定位有哪些改变
(CLLocationManager*)manager didChangeAuthorizationStatus:(CLLocationManager *)manager didFailWithError  iOS8下的地图定位:(CLAuthorizationStatus)status也写了
但是每次执行代码后都进入了委托方法- (void)locationManager,声明CLLocationManager对象后也添加了代码[locationManager requestAlwaysAuthorization];
新的委托方法- (void)locationManager:(NSError *)error中,在plist文件中添加了NSLocationAlwaysUsageDescription
NSLocationWhenInUseDescription 两个字段
为您提供更好的产品和服务
主营:七彩虹品牌主板,显卡等电脑及配件产品
其他类似问题
为您推荐:
地图的相关知识
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁ios8下地图定位有哪些改变_百度知道
ios8下地图定位有哪些改变
提问者采纳
(CLLocationManager *)manager didFailWithError:(NSError *)error中,声明CLLocationManager对象后也添加了代码[locationManager requestAlwaysAuthorization],在plist文件中添加了NSLocationAlwaysUsageDescription
NSLocationWhenInUseDescription 两个字段:(CLLocationManager*)manager didChangeAuthorizationStatus:(CLAuthorizationStatus)status也写了
但是每次执行代码后都进入了委托方法- (void)locationManager  iOS8下的地图定位;
新的委托方法- (void)locationManager
资深电脑人
其他类似问题
为您推荐:
地图的相关知识
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁}

我要回帖

更多关于 改变百度地图定位 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信