Setting an image for a UIButton in code.

Posted by Spanky on Stack Overflow See other posts from Stack Overflow or by Spanky
Published on 2009-09-24T02:06:31Z Indexed on 2010/06/09 12:02 UTC
Read the original article Hit count: 171

Filed under:
|
|
|

Hi,

How do you set the image for a UIButton in code?

I have this:

UIButton *btnTwo = [UIButton buttonWithType:UIButtonTypeRoundedRect]; 
btnTwo.frame = CGRectMake(40, 140, 240, 30);
[btnTwo setTitle:@"vc2:v1" forState:UIControlStateNormal];
[btnTwo addTarget:self action:@selector(goToOne) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:btnTwo];

but don't see what will set the image for it.

Any help appreciated, Thanks // :)

© Stack Overflow or respective owner

Related posts about iphone

Related posts about objective-c