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

why when we call the “task” variable, it has to be written as “task()”
why there need add '!' in code suffix
How to define a PFRelation on MongoLab, like the way it was on Parse?
Generic Addition Function Swift
Swift observevalueforkeypath + loadedTimeRanges only called limited times
how to set the position for part of the text in UILabel [duplicate]
In Swift how do I display a percentage value rounded up or down with no decimal places
UIView is nil after moving to the selected index via UITabBarController
Swift SpriteKit use struct instead of class to render sprites
Pop a View when click the StatusBar Item
NSFetchedResultsController calls delegate when data is deleted but not when data is inserted
Call parent constructor when init a subclass in Swift
Swift why does as? require AnyObject vs Any
Unable to play video using AVPlayer with Swift
2 decimal timer in swift
must call a designated initializer of the superclass NSManagedObject - in swift

Categories

HOME
cil
symfony
app-inventor
blockchain
wildcard
uibutton
laravel-5.3
json-ld
reportportal
otrs
avro
bibtex
apple-numbers
file-io
docker-windows
i2c
click
hosts
wordpress-theming
activesync
nuxt.js
zoomcharts
tweets
hhvm
facebook4j
badge
activepython
python-textprocessing
katharsis
opencart2.3
onesignal
solidworks
forum
bitcoin-testnet
xor
referenceerror
ioc-container
protobuf-net
nsurlconnection
pace
color-scheme
lexical-analysis
intellilock
productivity
data-integration
persistent
maintenance
paas
lotus
c64
multiple-file-upload
listadapter
fps
emokit
gradle-release-plugin
logcat
axes
approval-tests
test-class
enyo
subresource-integrity
risk-analysis
mdm-zinc
jazz
pl-i
cpan
viewflipper
candidate-key
docopt
suffix-array
log4cplus
mov
power-law
alpha-transparency
reserved-words
ksoap2
real-time-updates
nsmatrix
installshield-2011
driver-signing
dllexport
dynamics-ax-2009
angularjs-timeout
dynamic-data
git-filter-branch
symfony-2.0
unions
file-exists
revert
winverifytrust
multibyte-functions
oggvorbis
act
revision
dirty-data
configurable
data-entry
interface-design

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