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

is it possible save data from different view controller and show it at same tableviewcell?
Why does my SKAction run twice even after removing parent node?
What does the arrow mean in a function's argument in Swift 3.x?
How to load UI with escaping closures and async calls?
SKAction not executing
swift3 getting Initialization of immutable value 'task' was never used on URLSession.shared.dataTask(with: url!)
JTCalendar Memory Leak
Using a Timer in the background thread to update UI
UITableview with dynamic height cells & filling footer view
UINavigationBar changing to unexpected colors on scroll/transition
Passing Class.Type into a function Swift
Grand Central Dispatch
extracting value from IOPSCopyPowerSourcesInfo() swift
swift facebook education and occupation
Swift project unit testing fail
Swift 3 Uploading data to a server with Alamofire

Categories

HOME
cakephp-3.x
app-inventor
vhdl
bower
translation
concourse
sequelize.js
schemacrawler
apiconnect
google-plus
android-viewpager
lotus-notes
lagom
gatsby
x-frame-options
store
multiple-monitors
medium-editor
opera-mini
dendrogram
bar-chart
python-unicode
off-canvas-menu
ng2-dragula
avplayeritem
spring-ws
header-files
piwik
pipelinedb
ui5
winscp
getjson
entity-system
receipt
pycparser
salesforce-chatter
service-locator
powershell-remoting
remote-server
mmdrawercontroller
jboss-esb
readfile
react-native-router-flux
microdata
spring-bean
catia
z3py
rdw
fqdn
jtds
double-buffering
nsjsonserialization
walmart-electrode
rhel6
maintenance
castle-dynamicproxy
unity3d-editor
collapsingtoolbarlayout
redux-router
ingres
autoresize
restivejs
activeweb
rstudio-server
pydio
firepath
dojox.charting
clob
codesign
freefem++
asp.net-mvc-partialview
portfolio
license-key
acm
jenkins-scriptler
hornetq
textkit
response-headers
stackframe
low-level
sqoop2
lexicographic
activity-streams
line-numbers
errorprovider
ibmsbt
firebug-lite
kraken.js
lumx
visualstatemanager
xenocode
flash-cc
edit-in-place
gfs
magicalrecord-2.2
execvp
swrl
backbone-relational
database-permissions
objcmongodb
trailing-slash
mvs
ubuntu-11.10
enumerators
maven-ear-plugin
subtract
getstring
text-services-framework
signals2
entity-framework-ctp5
nsindexpath
tcxgrid
scraperwiki
datacontract
hardware-acceleration
external-assemblies
rtsp-client

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile