Creating a UIButton

suggest change

UIButtons can be initialized in a frame:

Swift

let button = UIButton(frame: CGRect(x: x, y: y, width: width, height: height)

Objective C

UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(x, y, width, height)];

A specific type of UIButton can be created like this:

Swift

let button = UIButton(type: .Custom)

Objective C

UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];

where type is a UIButtonType:

enum UIButtonType : Int {
    case Custom
    case System
    case DetailDisclosure
    case InfoLight
    case InfoDark
    case ContactAdd
    static var RoundedRect: UIButtonType { get }
}

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents