enable sendButton after didUpdateUserLocation

This commit is contained in:
nixzhu
2015-05-04 21:27:11 +08:00
parent 675fe302da
commit bdd59a67ac
2 changed files with 6 additions and 2 deletions
+1
View File
@@ -194,6 +194,7 @@
</navigationItem>
<connections>
<outlet property="mapView" destination="N6L-U8-EFf" id="xfc-We-pFG"/>
<outlet property="sendButton" destination="Dek-I8-RQb" id="pzq-pU-tOf"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="b42-ms-7Bt" userLabel="First Responder" sceneMemberID="firstResponder"/>
@@ -11,7 +11,7 @@ import MapKit
class PickLocationViewController: UIViewController {
@IBOutlet weak var sendButton: UIBarButtonItem!
@IBOutlet weak var mapView: MKMapView!
var isFirstShowUserLocation = true
@@ -22,6 +22,8 @@ class PickLocationViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
sendButton.enabled = false
mapView.showsUserLocation = true
mapView.delegate = self
@@ -57,7 +59,6 @@ class PickLocationViewController: UIViewController {
mapView.addAnnotation(pin)
userPickedLocationPin = pin
}
}
@@ -68,6 +69,8 @@ extension PickLocationViewController: MKMapViewDelegate {
if isFirstShowUserLocation {
isFirstShowUserLocation = false
sendButton.enabled = true
let location = userLocation.location
let region = MKCoordinateRegionMakeWithDistance(location.coordinate, 2000, 2000)
mapView.setRegion(region, animated: true)