I am aware that a pushed button can be updated by reference to sender. However I want to access a button from the program body by reference to its tag and then update its label,if that is possible. Suggestions on how to do this (in Swift) would be appreciated.
To get a button inside a view using its tag, you can use the UIView.viewWithTag
function.
if let button = self.view.viewWithTag(tag) as? UIButton
{
button.setTitle("newTitle", forState: UIControlState.Normal)
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With