Posts

Showing posts with the label UIButton

Uibutton At Your Convenience

UIButton is 1 of those classes where y'all receive got to receive got quite a few steps to ready an instance if y'all require anything beyond the default. For example, I would similar to practise a circular push clitoris alongside a title, border, background colour, etc. extension UIButton { convenience init(withRadius radius:CGFloat, title:String, titleColor:UIColor, target:UIViewController, selector:Selector, backgroundColor:UIColor, borderColor:UIColor, borderWidth:CGFloat, position:CGPoint) { self.init() self.setTitle(title, for: .normal) self.setTitleColor(titleColor, for: .normal) self.addTarget(target, action: selector, for: .touchDown) self.backgroundColor = backgroundColor allow diameter = ii * radius self.frame = CGRect(x: position.x, y: position.y, width: diameter, height: diameter) self.layer.cornerRadius = radius self.layer.masksToBounds = imitation self.layer.borderWidth = border...