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

Create Rounded Corner focusRing NSTextField
Why adding action to button in UICollectionViewCell not working well?
TextFields are not showing in storyboard?
Drag GoogleMaps-Marker via swiping over map
NSUTF8StringEncoding not working when decoding the same message
Where to add `addPersistentStoreWithType:configuration:URL:options:error:` in Swift Core Data Application?
I need to set a notification on a specific day every week.. but I don`t care the day of the month
Xcode Swift Quick Help Closures
Swift Inherited Protocols and Conformance Checking for the Parent-Protocol
Copy NSTableView row greyed out
How to find out if card was declined in Braintree Payments
how to create a class and return something. Swift
Call custom action in spritekit around 100 times in 3 seconds
Firebase Storage Upload Error: FIRStorageErrorDomain Code=-13000
Use of instance member 'meow' on type 'Cat' did you mean to use a value of type 'Cat' instead?
Correct way to redraw NSTextView

Categories

HOME
sharepoint
ajax
sas
jdbc
numpy
shopify
dynamics-crm
mapping
google-contacts
h2
algorithmic-trading
simpy
facebook-javascript-sdk
hashicorp-vault
abcpdf
phoenix
titan
bar-chart
saiku
prediction
scalaz7
hhvm
azure-servicebus-queues
bus-error
rhandsontable
maximo
frp
system.data.sqlite
dhtmlx-scheduler
superscript
jboss5.x
vegan
stocks
idl
rhino
viewstate
honeysql
windows-10-iot-core
css-counter
jquery-cycle2
google-guava-cache
mms
resuming-training
dojox.grid.datagrid
startapp
vcf
fqdn
webdatagrid
google-maps-ios
android-bitmap
fedora20
hpcc
paas
uicollectionviewlayout
polar-coordinates
vici
alter
debugdiag
chessboard.js
easing
git-annex
angularjs-ng-pattern
webkit2
linkageerror
windows-nt
scriptlet
twgl.js
flexjson
asp.net-mvc-2
fortran90
intellitest
hornetq
wikitext
evo
selendroid
p-np
built-in
castle-windsor-3
sparse-file
gray-code
apache-mina
google-plus-one
uptodate
cpu-speed
kendo-mvvm
google-admin-audit-api
outline
facebook-wall
csplit
alpha-transparency
io.js
valence
visualstatemanager
circos
arangodb-php
leptonica
dynamic-binding
dig
carddav
fraud-prevention
couchdb-lucene
tfs-power-tools
windows-phone-7-emulator
wchar
datamember
easygui
unreachable-code
jquery-ui-button
rtsp-client
plinq
writing

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