how can i set the background color of a particular button in iphone ?
Posted
by suchita
on Stack Overflow
See other posts from Stack Overflow
or by suchita
Published on 2010-04-21T09:04:43Z
Indexed on
2010/04/21
9:13 UTC
Read the original article
Hit count: 160
for this I used
btnName1 = [ColorfulButton buttonWithType:UIButtonTypeRoundedRect];
btnName1.frame=CGRectMake(45,146,220,40);
[btnName1 setTitle:@"Continue" forState:UIControlStateNormal];
[btnName1 setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
[btnName1 setImage:[UIImage imageNamed:@"green.png"] forState:UIControlStateNormal];
UIImage *img =[UIImage imageWithContentsOfFile:[[NSBundle mainBundle]pathForResource:@"greenish" ofType:@"png"]];
UIImage *strechableImage = [img stretchableImageWithLeftCapWidth:12 topCapHeight:0];
[btnName1 setBackgroundImage:strechableImage forState:UIControlStateNormal];
[btnName1 setNeedsDisplay];
[InfoView addSubview:btnName1];
it's correctly working on iphone simulator but not on ipod(color not show in ipod)
© Stack Overflow or respective owner