How to hide a button in Xcode 6?

All I want to do is keep the button pressed until another button is pressed.

For example, button 1 is visible, but button 2 is not. When I press button 1, I need button 2.

In addition, I program in Xcode 6 using Swift.

Thanks in advance!

+6
source share
1 answer

Sample code for hiding a button in Swift:

import UIKit class ViewController: UIViewController { // Create outlet for both the button @IBOutlet weak var button1: UIButton! @IBOutlet weak var button2: UIButton! override func viewDidLoad() { super.viewDidLoad() //Set button2 hidden at start button2.hidden = true } //Here is the action when you press button1 which is visible @IBAction func button1(sender: AnyObject) { //Make button2 Visible button2.hidden = false } } 

Maybe this can help you.

+15
source

Source: https://habr.com/ru/post/978364/


All Articles