I have a rectangle image (jpg) and want to use it to fill the background of a button with rounded corner in xcode.
I wrote the following:
UIButton *b
UIButton* closeBtn = [[UIButton alloc] initWithFrame:CGRectMake(10, 50, 90, 35)]; //Customise this button as you wish then closeBtn.layer.cornerRadius = 10; closeBtn.layer.masksToBounds = YES;//Important