I want to display google maps on a view that\'s then added to self.view
, rather than drawing the map directly on self.view
. Therefore, I created a
CGRect.zero will return a view with zero height and zero width. It will be invisible.
Also, it doesn't really make sense to add it in to the storyboard if you want to do your own allocation. You should instead just create a property of the view controller programmatically, and set its frame to be whatever you want.
Note, when you call 'addSubview' to a view, it will always be added to the top of the view, so there's no need to insert it at a given index. Using auto-layout is good, but viewDidLoad() gets called before all of the constraints are set. If you want to be able to set your mapView's frame = self.view, you would want to do that in viewDidAppear() instead.