swift 中高德地圖隨時讀取座標地點的寫法

來源:互聯網
上載者:User

自己寫的方法  不比比  自己能看懂就行   只用作自己學習swift的總結



import UIKit


typealias block = (String,String) ->()


class MoveCarViewController: UIViewController,MAMapViewDelegate,AMapLocationManagerDelegate,AMapSearchDelegate,UITextFieldDelegate,UIAlertViewDelegate,UIGestureRecognizerDelegate {

    

    //大視圖

    @IBOutlet weak var bgView: UIView!

    

    //小車按鈕

    @IBOutlet weak var smallCarButton: UIButton!

    

    //大車按鈕

    @IBOutlet weak var bigCarButton: UIButton!

    

    

    //車牌選擇按鈕

    @IBOutlet weak var plateButton: UIButton!

    

    //車牌號輸入框

    

    @IBOutlet weak var plateTextFild: UITextField!

    

    //選擇照片按鈕

    @IBOutlet weak var photoButton: UIButton!

    

    //存放照片view

    @IBOutlet weak var ImageView: UIView!

    

    //存放照片button

    @IBOutlet weak var ImageButton: UIButton!

       

    //存放地圖視圖的地板

    

    @IBOutlet weak var firstView: UIView!

    

    

    //手動上報位置按鈕

    @IBOutlet weak var manualButton: UIButton!

    

    //位置資訊label


    @IBOutlet weak var locationLabel: UILabel!

    

    

    //提交按鈕

    @IBOutlet weak var submitButton: UIButton!

    

    var popView : PopoverView?

    

    var db : FMDatabase?

    

    //車牌資料

    lazy var plates : [String] = {

        

        return PlateNumber.PlateNumbers() as! [String]

        

    }()

    

    var imageOne : UIButton?

    

    var imageTwo : UIButton?

    

    var index = 1

    

    var imageFileStr : String? = ""

    

    //對方車牌號

    var HPHM = UITextField()

    

    //挪車地址

    var Address = UILabel()

    

    //當前選中機動車類型

    

    var vehicleType1 = CarType()

    

    var vehicleType2 = CarType()

    

    var tmpcoordinate = CLLocationCoordinate2D()

    

    var carTypes : NSMutableArray!

    

    var carCitys : NSMutableArray!

    

    var tmpcity : String = ""

    

    var uploadFileList : NSMutableArray!

    

    var currentSelectedButton : UIButton = UIButton()

  

    var backImage : UIImageView!

    

    var label = UILabel()

    

    var city : String!

    

    var mapView : MAMapView?

    

    var search : AMapSearchAPI?

    

    var centerMarker : UIButton!

    

    var mapLacationManager = AMapLocationManager()

    

    var centerCoordinate:CLLocationCoordinate2D?

    

    //追蹤指標位置的移動

    func mapView(mapView: MAMapView!, regionDidChangeAnimated animated: Bool) {

        

        delAddress()

        

    }

    

    var myBlock : block!

    



    

    

    

    

    //執行查詢語句

    func searchCarType() {

        

                var resultSet : FMResultSet? = db?.executeQuery("SELECT rowid, * FROM chePaiType  ORDER BY rowid ASC;", withArgumentsInArray: nil)

        

                var tmparray : NSMutableArray

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.