Answers for "swift uibutton action programmatically"

1

swift uibutton programmatically set ontap function

myButton.addTarget(self, action: #selector(myButtonTapped), for: .touchUpInside)
@objc func myButtonTapped() {
    print("My button was tapped!")
}
Posted by: Guest on June-29-2021
0

how to create button action programmatically in ios

let button   = UIButton(type: UIButtonType.System) as UIButton
button.frame = CGRectMake(100, 100, 100, 50)
button.backgroundColor = UIColor.greenColor()
button.setTitle("Test Button", forState: UIControlState.Normal)
self.view.addSubview(button)
Posted by: Guest on December-17-2021

Code answers related to "swift uibutton action programmatically"

Code answers related to "Swift"

Browse Popular Code Answers by Language