set cornerRadius and setbackgroundimage to UIButton
Here is how I would create a button through code and set its background color. UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom]; btn.frame = CGRectMake(100, 100, 100,50); [btn setTitle:@”Hello” forState:UIControlStateNormal]; [btn setBackgroundColor:[UIColor colorWithRed:128.0/255.0f green:0.0/255.0f blue:0.0/255.0f alpha:0.7]]; btn.frame = CGRectMake(100.0, 100.0, 120.0, 50.0);//width and height should be same value btn.clipsToBounds = YES; btn.layer.cornerRadius = 20;//half of the width … Read more