i am having rootview controller in my navigationn controller and if i want to set a image to my bottom bar and top bar in my root view controller using programmatically .. how to set it ? plz any bidy help me out
A:
If you are looking to add an image to the bars, see this URL:
http://www.iphonedevsdk.com/forum/111227-post11.html
This demonstrates how to add a graphical "Info" button to a navbar, but the same principle applies with a UIImageView instead of a UIButton.
Here is the code snipplet from the link:
UIButton *btn=[[UIButton alloc] init];
[btn setImage:[UIImage imageNamed:@"info44.png"] forState:UIControlStateNormal];
[btn setImage:[UIImage imageNamed:@"info44_glowing.png"] forState:UIControlStateHighlighted];
[btn addTarget:self action:@selector(showAbout) forControlEvents:UIControlEventTouchUpInside];
[btn setImageEdgeInsets:UIEdgeInsetsMake(0, 0, 0, 20)];
UIBarButtonItem *b=[[UIBarButtonItem alloc] initWithCustomView:btn];
self.navigationItem.rightBarButtonItem=b;
[b release];
[btn release];
Hope that helps!
Dutchie432
2010-07-09 20:09:58
thanks for that,and if i want to add image background to uibar then hhow can i....
lak in iphone
2010-07-09 21:04:19
yes i am able to see my button on topbar right side ,but if i want to show on bottom bar?
lak in iphone
2010-07-09 21:36:48