Xcode iOS Development with Swift Tutorial – Show and Hide Views
If you want to make a popup menu or just a pop-up view with more content, this is the most practical and simple way to do it.
Here is the code for showing and hiding a view with a button-
@IBOutlet weak var menuView: UIView!
@IBOutlet weak var menuButton: UIButton!
@IBAction func menuButtonPressed(_ sender: Any) {
if (menuView.isHidden == true) {
menuView.isHidden = false
}
else {
menuView.isHidden = true
}
}
Download the menu icon (or any material design icon) here- http://www.flaticon.com/packs/material-design
MUSIC-
Clear Air Kevin MacLeod (incompetech.com)
Licensed under Creative Commons: By Attribution 3.0 License
https://creativecommons.org/licenses/
Comments are closed.