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

Parse Query - Images near GeoPoint
Iterate an RLMArray in Swift
EXC_BAD_ACCESS on waitForExpectations while unit testing
How do I pass a class as a parameter in Swift?
Mac app unable to read app bundle resources
randomly picking skspritenode node to spawn out of 5 sprites
Superimpose a user filled out UITextView over an image with CGRect, not the same as combining two images?
Add a top padding to IoS app WKWebView
Translating Obj-C blocks into Swift for AFNetworking calls
How to make post request in CURL with Perfect
Get Street Address From Contact Swift
Get name of closest business using Swift's CoreLocation
Swift dealing with Actions and Selectors Issue -
How to Save Data and Segue Back to Collection View?
&& and || in while loops
Collision dectection acting randomly

Categories

HOME
signalr
oauth
visual-studio-2013
youtube-livestreaming-api
sbt-assembly
codeblocks
xcode8.3
structuremap
click
uiactivityviewcontroller
criteria
wysiwyg
data-analysis
store
rapidjson
riak
r-lavaan
rhapsody
apache-karaf
anychart
chocolatey
internet-explorer-8
prestodb
mousewheel
tortoisegit
backpropagation
marathon
rworldmap
myob
logarithm
iis-10
pdfsharp
croppic
ui5
emv
web-frontend
referenceerror
strophe
pyscripter
google-drive-realtime-api
geopy
rhomobile
rhino
passenger
concrete5-5.7
deepstream.io
stdclass
nashorn
median
startapp
archer
jtds
timesten
applepayjs
component-pascal
slidesjs
communication-protocol
gmt
createobject
inject
sql-import-wizard
slam-algorithm
unsatisfiedlinkerror
coordinate-transformation
freefem++
proxygen
cmocka
sonarqube5.3
direct3d12
zuora
site-prism
textkit
futuretask
subresource-integrity
graphical-logo
uos
web-component-tester
adodb
tilestache
moai
cpu-speed
cloudpebble
line-numbers
node-imagemagick
wss
va-list
visual-studio-2003
backbone-relational
pascals-triangle
snapjs
pys60
radchart
visual-web-gui
ou
curljs
posting
dashcode
nagle
post-redirect-get
drawtext
svn-hooks
open-graph-beta
recordset
external-assemblies
trampolines
google-instant
scatterview
opcodes
method-signature
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