I have a MapKit view, which initially loads with the map of North America.
I have a button on this MapKit, on my storyboard as an image. I've hooked it to my ViewController with an @IBAction
.
But, I want to hide this button when my view loads initially, and show it only when the user has zoomed in to the map.
Is it possible to somehow hide this button on the initial load? Do we need to reference the action to a UIButton or vice-versa ?
Since @IBAction
designates a function, not an object, you cannot use it to access your UIButton
until it is called.
In order to access a button at will you need to make an @IBOutlet
in addition to @IBAction
that you have, and tie your button to it. This would let you set hidden
property as needed:
button.hidden = YES;