Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to implement button with backgroundimage programmatically in iphone

Tags:

I'm developing images in view with button programmatically in iphone. now I want to add button backgroundimage for next and previous buttons. I want to add a images for these buttons programmatically.

how to add button image in iphone.

like image 605
user549767 Avatar asked Feb 16 '11 03:02

user549767


1 Answers

// Add the button like this

UIImage *redButtonImage = [UIImage imageNamed:@"ExitButton.png"];          UIButton *redButton = [UIButton buttonWithType:UIButtonTypeCustom];         redButton.frame = CGRectMake(280.0, 10.0, 29.0, 29.0);         [redButton setBackgroundImage:redButtonImage forState:UIControlStateNormal];          [view addSubview:redButton]; 
like image 121
Sudhanshu Avatar answered Oct 17 '22 08:10

Sudhanshu