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

How to convert CGWindowID to CFTypeRef?
How to hide dots on last view of UIPageViewController SWIFT
custom console log in swift [duplicate]
UI Test Success but never Runs on Mac
How to fake Realm Results for tests
Swift wait until dataTaskWithRequest has finished to call the return [duplicate]
Making a GIF from images using Swift (macOS)
NSTableView cells ontop of header
CoreData/TableView - Ambiguous use of 'subscript'
Saving the users username to the firebase database using swift in Xcode
Swift: Help finding inconsistencies that are making my app crash [duplicate]
Correct release NSViewController embedded in subviews
How to fetch stickers collection from iMessage?
Adding constraint (programmatically) for NSView never returns
Java BigDecimal in Swift
Under what situation Swift Cannot infer the type to be use?

Categories

HOME
cntk
sidekiq
translation
json-ld
reportportal
matplotlib
search-engine
dataframe
google-spreadsheet-api
openwrt
octopus-deploy
unity2d
game-physics
rhapsody
jogl
mousewheel
clover
cvs2svn
nmake
explode
restfb
csh
opencart2.3
emv
xilinx-ise
mayavi
dpi
winscp
pcre
backup-strategies
pdflatex
receipt
data-extraction
soundjs
exiftool
android-maps-v2
excel-interop
filepath
lumen-5.3
uiviewpropertyanimator
bnd
mbaas
ruby-on-rails-2
bettercms
emgu
hspec
mongoose-populate
multiple-file-upload
database-backups
clob
console-redirect
usb-drive
twgl.js
interactive-brokers
magento-1.4
void
asymptote
mirrorlink
datasnap
response-headers
consensus
proximity
cg
yahoo-boss-api
surrogate-key
bullet
funkload
map-force
openkinect
osx-snow-leopard
vertical-rhythm
windows-update
ienumerator
soa-suite
vt100
crocodoc
linkedhashset
autostart
responsetext
wchar
surf
goliath
cookieless
rijndael
libavformat
out-of-browser
surefire
code-design
economics
standardized

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