I've created UITabBar (items: info, location and description) in the middle of the content and now i want to set custom background image for tab bar, default select first button and get action when user select another tab bar item.
Here is ss of tab bar: http://dl.dropbox.com/u/77033905/tabBar%20in%20the%20middle.png
Tell me pls answers on this questions:
- How to set custom background image for thisd tab bar?
- How to get selected item?
- How to default selected first item?
For now I've created UITabBar and include in this ViewController, what's next?
This is ViewController.h:
@interface ViewController : UIViewController<UITabBarDelegate> {
UITabBar *tabBar;
}
@property (strong, nonatomic) IBOutlet UITabBar *tabBar;
...
View.m:
#import "ViewController.h"
@interface ViewController ()
@end
@implementation OfferViewController
@synthesize tabBar;
- (void)viewDidLoad
{
[super viewDidLoad];
UIImage *selectedImage0 = [UIImage imageNamed:@"HomeDB.png"];
UIImage *unselectedImage0 = [UIImage imageNamed:@"HomeLB.png"];
UIImage *selectedImage1 = [UIImage imageNamed:@"ScheduleDB.png"];
UIImage *unselectedImage1 = [UIImage imageNamed:@"ScheduleLB.png"];
UIImage *selectedImage2 = [UIImage imageNamed:@"BuildingsDB.png"];
UIImage *unselectedImage2 = [UIImage imageNamed:@"BuildingsLB.png"];
//UITabBar *tabBar = self.tabBar;
UITabBarItem *item0 = [tabBar.items objectAtIndex:0];
UITabBarItem *item1 = [tabBar.items objectAtIndex:1];
UITabBarItem *item2 = [tabBar.items objectAtIndex:2];
[item0 setFinishedSelectedImage:selectedImage0 withFinishedUnselectedImage:unselectedImage0];
[item1 setFinishedSelectedImage:selectedImage1 withFinishedUnselectedImage:unselectedImage1];
[item2 setFinishedSelectedImage:selectedImage2 withFinishedUnselectedImage:unselectedImage2];
[super viewDidLoad];
}
...
How can I now default select item and get when user tabs on some tab bar item?