小编Mur*_*rph的帖子

Swift Mapkit - 远离用户位置

我想显示用户位置和周围区域,但我也希望允许用户在该区域内平移.现在,如果我尝试在地图上的其他位置滚动,它会自动将我带回到基本区域,用户位于中心.我怎么阻止这个?我想在中心显示用户的初始视图,但我希望能够滚动.在此先感谢您们的帮助!

导入UIKit导入MapKit导入CoreLocation

class ViewControllerMain:UIViewController,MKMapViewDelegate,CLLocationManagerDelegate {

@IBOutlet weak var mapView: MKMapView!

var locationManager:CLLocationManager!

override func viewDidLoad() {
    super.viewDidLoad()
    locationManager = CLLocationManager()
    locationManager.requestWhenInUseAuthorization()
    locationManager.desiredAccuracy = kCLLocationAccuracyBest
    locationManager.delegate = self
    locationManager.startUpdatingLocation()
    mapView.showsUserLocation = true
    mapView.delegate = self

    let longPress = UILongPressGestureRecognizer(target: self, action: "action:")
    longPress.minimumPressDuration = 1.0
    mapView.addGestureRecognizer(longPress)
}

override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
}

func locationManager(manager: CLLocationManager!, didUpdateLocations locations: [AnyObject]!) {
    let regionToZoom = MKCoordinateRegionMake(manager.location.coordinate, MKCoordinateSpanMake(0.01, 0.01))
    mapView.setRegion(regionToZoom, animated: true)
}
Run Code Online (Sandbox Code Playgroud)

xcode mapkit ios swift

8
推荐指数
1
解决办法
4589
查看次数

在AspNetUsers中存储其他用户属性

将属性扩展/添加到AspNetUsers表中的最佳做法是什么?(.Net Core 2.0)

1)您可以在AspNetUsers表中添加其他属性

2)您可以将内容放入声明中

3)您可以在属性中放置对另一个表的引用

4)您可以使用user.id并将其与更多数据一起存储在另一个表中

那么最佳实践是什么?

.net asp.net-mvc asp.net-identity .net-core asp.net-core-2.0

0
推荐指数
1
解决办法
67
查看次数