Swift
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
let button = UIButton(type: UIButton.ButtonType.system) as UIButton
let xPostion:CGFloat = 50
let yPostion:CGFloat = 100
let buttonWidth:CGFloat = 150
let buttonHeight:CGFloat = 45
button.frame = CGRect(x: xPostion, y: yPostion, width: buttonWidth, height: buttonHeight)
button.setTitle("Tap me", for: UIControl.State.normal)
button.backgroundColor = UIColor.blue
button.tintColor = UIColor.white
button.addTarget(self, action: #selector(self.buttonAction(_:)), for: .touchUpInside)
button.isEnabled = false
self.view.addSubview(button)
}
@objc func buttonAction(_ sender:UIButton!)
{
print("Button tapped")
}
}
Linux - How to Install anc-api-tools
Linux - How to Install curvedns
Linux - How to Install zenmap
Python - Check if a Number is Positive, Negative or 0
C - Count Number of Digits in an Integer
C - Find Largest Number Using Dynamic Memory Allocation
Python - Writing Excel (XLSX) Files
C++ - Check Whether a Number is Prime or Not
Kotlin - Reverse a Number
Kotlin - Find Factorial of a Number
JavaScript - Check Whether a String Starts and Ends With Certain Characters
Linux - How to Install zstd
Linux - How to Install xbitmaps
Python - Bubble Sort
C++ - Find Quotient and Remainder
Java - Reverse a Number
C++ - Check Leap Year
Kotlin - Round a Number to n Decimal Places
We have been online since 2021 and 1 millions of people around the globe have visited our website since then
More visitors every month