Not using programatic views


I know this question is against the chapters title, but can the steps in Chapter 6 also be achieved by drag & drop of controls in the main.storyboard. For example

How to add the segmented control with drag & drop?



Yes you can. Of course there are a few things to take in account.

The book approach is “programmatic” and, as such, MKMapView() is attached as view of the viewcontroller programmatically inside viewcontroller method ‘loadView()’.

if you added segmentedControl in storyboard, you’ll end up with no visible segmentedControl because in loadView() you’re actually overriding normal view load process from nib (from storyboard) and manually attach a different view to controller (MKMapView).

In short, you can do this but you need to do so all in storyboard (mapview and segmentedControl) deleting loadView() implementation.

Thats what I thought, problem I’m seeing is that if I place a MapKit View on the page then add a Segmented Control, I lose the MapKit View… and vise versa?

Is there any trick to doing this visually in storyboards, I’d love to see the alternate way than the book describes



Seems if I add a view then I have the ability to add the MapKit and the Segmented control.

Any thoughts if thats the correct way?