问题描述
- IOS中在uiwebview怎么定位,或者访问百度地图可以定位
-
import UIKit
import CoreLocationclass 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. }
}
这样设置没用,新手求大神们指导下!
时间: 2024-11-03 06:43:33