swift


Button on Annotation is not appearing


I have a problem with my app. In fact, when I am running my code in a separate app it is working. xCode is not showing me any errors and everything works fine but I can't see a detail button in my Annotations on MapKit. Is there a problem deeper in xCode?
That is my code:
func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView? {
let identifier = "Education"
if annotation is Education {
var annotationView = mapView.dequeueReusableAnnotationView(withIdentifier: identifier)
if annotationView == nil {
annotationView = MKPinAnnotationView(annotation: annotation, reuseIdentifier: identifier)
annotationView!.canShowCallout = true
let btn = UIButton(type: .detailDisclosure)
annotationView!.rightCalloutAccessoryView = btn
} else {
annotationView!.annotation = annotation
}
return annotationView
}
return nil
}
It looks like this on my app - no detail button on the right side of annotation.
you have to set the delegate for your mapView. I usually do it in the viewDidLoad of the ViewController the mapView is in.
mapView.delgate = self
is the code you need to add.

Related Links

Swift : Change size of UIButton programmatically
make init() private for NSObject subclass
Data not being added to Parse?
The main thread locked when fetching images from parse with semaphore
How do you make a transparent view that changes color [closed]
swift uploadTaskWithRequest with didReceiveData
stringByReplacingOccurrencesOfString removes whole string
Why can I use a constant initialization as if-condition? [duplicate]
How to convert Optional String to String
Unwrap an Optional Within a Multiple Parameter Function
Swift on Ubuntu - No such file or directory
Swift: programmatically enumerate outgoing segues from a UIVIewController
Can't get plist URL in Swift
Getting data from Parse in condition
How to assign an image from URL to NSData by swift?
Swift append String var to an List by reference

Categories

HOME
checkbox
angular-cli
rotation
mapping
ipython
firebase-app-indexing
bower
extract
playframework
computer-vision
ruby-on-rails-3
terrain
branch.io
filter
simpy
proguard
gimp
lotus-notes
iso
abcpdf
informatica-powercenter
webmethods
scaling
tree-traversal
multicore
plsqldeveloper
uiautomator
scalaz7
spring-ws
csh
non-deterministic
hanami
lync-2013
dss
multichoiceitems
piecewise
apache-cloudstack
skygear
large-data
android-download-manager
parse-android-sdk
axis-labels
duktape
magiczoomplus
wsadmin
code-composer
paho
crop
stress-testing
facebook-chatbot
archer
vcf
gd
cdk
pycurl
garrys-mod
efxclipse
objloader
keycode
inject
sql-import-wizard
cleditor
update-site
database-backups
contour
string-parsing
gemini
picking
inet
anti-cheat
servlet-3.0
ipojo
mogrify
crash-dumps
uos
gulp-livereload
adobe-indesign
web-component-tester
hg-git
jai
errorprovider
vcl
yahoo-boss-api
aquafold
alpha-transparency
factors
zipalign
opensocial
edit-in-place
nsmatrix
multiple-login
shortcuts
htmltextwriter
symfony-2.0
parameterization
file-exists
point-sprites
viewdidload
emacs23
fileutils
zookeeper
datamember
curljs
symbol-server
asp.net-routing
delegatecommand
clients
lazy-c++
castle-validators
visual-studio-dbpro

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App