Adam
Adam

Reputation: 135

Need guidance with segment control in swift

Since im still new to coding i need help figuring this out since i don't know how to get around it. I got a segment control to switch between standard, satellite and hybrid. But it is in the sidebarmenu and the class is tableviewcontroller. I need it to interact with the mapkit so i can get it to work when pressing the button. I already got a code but need guidance/help to get it to work.

Thanks in advance!

Putting an image up here:

Segment Control Issue

Upvotes: 0

Views: 49

Answers (2)

Zolnoor
Zolnoor

Reputation: 699

If you look at your code you can see that you made an MKMapView by initializing it at a class scope with: var mapView = MKMapView()

What this did was allocate memory for the map and create it, but it is not on the screen. You will have to either add it via Interface Builder (the UI GUI on the left of your screenshot) or you will have to programmatically add it to the view.

This is a tutorial on how to do it via IB, and it looks like this is something you already looked at judging by your code...

It seems like you are brand new to writing code. You might want to consider taking a free Computer Science 101 class by MIT

Upvotes: 0

SaiPavanParanam
SaiPavanParanam

Reputation: 416

what exactly do you need? If you need explanation regarding the work you are doing... please follow this link.. https://www.raywenderlich.com/87008/overlay-views-mapkit-swift-tutorial This site tries to explain everything in detail. Please vote the answer you find it useful

Upvotes: 1

Related Questions