美文网首页
swift中百度地图的定位于显示

swift中百度地图的定位于显示

作者: 超越时空的思念_8a22 | 来源:发表于2017-09-21 14:44 被阅读0次

1、在Info.plist中添加NSLocationWhenInUseUsageDescription和NSLocationAlwaysUsageDescription设置为YES


2、在AppDelegate中

//初始化

let vc = ViewController()

//导航控制器

let nvc = UINavigationController(rootViewController: vc)

//添加到视图

self.window?.rootViewController = nvc


3.在ViewController中导入头文件

import MapKit

import CoreLocation

4、在新创建的控制器中(TUHRViewController)

//定义一个属性

var loc = CLLocation()



相关文章

网友评论

      本文标题:swift中百度地图的定位于显示

      本文链接:https://www.haomeiwen.com/subject/fjgzsxtx.html