2 zzd864582451 zzd864582451 于 2015.06.19 11:36 提问

IOS中在uiwebview怎么定位,或者访问百度地图可以定位

import UIKit
import CoreLocation

class ViewController: UIViewController,UIWebViewDelegate,CLLocationManagerDelegate {

var locationManager:CLLocationManager!

@IBOutlet weak var webview_: UIWebView!
override
func viewDidLoad() {
    super.viewDidLoad()
    locationManager = CLLocationManager();
    locationManager.desiredAccuracy = kCLLocationAccuracyBestForNavigation
    locationManager.requestAlwaysAuthorization()
    locationManager.delegate = self
    locationManager.startUpdatingLocation()
    var filepath:String = NSBundle.mainBundle().pathForResource("index",ofType: "html")!
    webview_.loadRequest(NSURLRequest(URL: NSURL(string: filepath)!))

}

override
func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated.
}

}
这样设置没用,新手求大神们指导下!

Csdn user default icon
上传中...
上传图片
插入图片