swift - 3D 视图

1.xib 上的 3D效果 按钮

2. 

import UIKit
//1.导入框架
import MapKit

class ViewController: UIViewController {

    @IBOutlet weak var mapView: MKMapView!
    
    override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
        //逆推第三部
        let center = mapView.centerCoordinate
        
        
        /*
         *  lookingAtCenter:可是中心
         *  fromEyeCoordinate:眼睛看到的坐标,从左还是从右边看
         *  eyeAltitude:眼睛高度, 海拔高度
         */
        //逆推第二部
        let camerea = MKMapCamera(lookingAtCenter: center, fromEyeCoordinate: CLLocationCoordinate2D(latitude: center.latitude + 0.1, longitude: center.longitude), eyeAltitude: 150)
        
        //逆推第一步
        mapView.setCamera(camerea, animated: true)
    }

}

  

猜你喜欢

转载自www.cnblogs.com/qingzZ/p/10113227.html
今日推荐