Search
 
SCRIPT & CODE EXAMPLE
 

SWIFT

create button with icon swift

button.setImage(UIImage(systemName: "search"), for: .normal)
Comment

swift create custom button with icon programmatically

let googleView = UIView()
googleView.layer.backgroundColor = UIColor.white.cgColor
googleView.frame = CGRect(x: 30, y: 100, width: view.bounds.width - 60, height: 50)
googleView.layer.cornerRadius = googleView.frame.height / 2
let googleButton = UIView()
googleButton.frame = CGRect(x: googleView.layer.cornerRadius, y: 0, width: googleView.frame.width - 2 * googleView.layer.cornerRadius, height: 50
let googleImage = UIImageView(image: UIImage(named: "googleLogo"))
googleImage.frame = CGRect(x: 0, y: 10, width: 30, height: 30)
googleButton.addSubview(googleImage)
let googleLabel = UILabel()
googleLabel.frame = CGRect(x: googleImage.frame.maxX, y: 10, width: 1000, height: 30)
googleLabel.text = "   Sign up with Google"
googleLabel.font = UIFont.boldSystemFont(ofSize: 17)
googleLabel.sizeToFit()
googleLabel.center.y = googleImage.center.y
googleButton.addSubview(googleLabel)
googleButton.frame.size.width = googleLabel.frame.maxX
googleButton.center.x = googleView.frame.width / 2
googleView.addSubview(googleButton)
let googleTap = UITapGestureRecognizer(target: self, action: #selector(googleLogin))
googleView.isUserInteractionEnabled = true
googleView.addGestureRecognizer(googleTap)
view.addSubview(googleView)


  [1]: https://i.stack.imgur.com/HaZyU.png
Comment

PREVIOUS NEXT
Code Example
Swift :: fetch request core data 
Swift :: how to change background color swift 
Swift :: swift view 
Swift :: Swift Handling Errors Using do-catch Statement 
Swift :: variable sum in swift 
Swift :: how to present a uiview after an array of cards is empty swift 
Swift :: Swift Right Shift Operator 
Swift :: Swift Objects 
Swift :: how to limit ui field in ios 
Swift :: Create enum of Errors Swift 
Swift :: set time programmatically swift 
Swift :: swift function 
Swift :: procedural audio with swift 
Swift :: Swift Nested Ternary Operators 
Swift :: swift core data order by 
Swift :: swift check if class is of type 
Swift :: Iterate Over enum Cases Swift 
Swift :: Allow user to import image 
Swift :: how to get ride of back button in navbar xcode 
Swift :: Swift Check if two sets are equal 
Swift :: swift get all cases starting with 
Swift :: swift class init 
Swift :: swift allow gesture recognizer over others 
Ruby :: ruby sort an object 
Ruby :: config.factory method syntax rails 
Ruby :: ruby reference a file in a gem 
Ruby :: rails destroy not working 
Ruby :: table name from rails console 
Ruby :: ruby string to symbol 
Ruby :: ruby generate array of alphabet 
ADD CONTENT
Topic
Content
Source link
Name
3+7 =