The bottom half of my UITabbar is not responding. I have found more people with the problem, but no solutions.
I think the problem may be caused by me not using the tabbar for a fullscreen application, but only a part of the screen (320*380 on iPhone). I am, however, using a custom UITabbarController. This is after the constructor for my UITabbarController subclass:
-(void)addCustomElements
{
UIImageView *tabBarBackground = [[UIImageView alloc] initWithFrame:CGRectMake(0, 306, 320, 74)];
[tabBarBackground setImage:[UIImage imageNamed:@"Tab Bottom.png"]];
[self.view addSubview:tabBarBackground];
UIImage *buttonImage = [UIImage imageNamed:@"Places Tab.png"];
UIImage *selectedImage = [UIImage imageNamed:@"Places Tab Selected.png"];
btn1 = [UIButton buttonWithType:UIButtonTypeCustom];
btn1.frame = CGRectMake(0, self.view.frame.size.height-42, 160, 44);
[btn1 setImage:buttonImage forState:UIControlStateNormal];
[btn1 setImage:selectedImage forState:UIControlStateSelected];
[btn1 setTag:0];
[btn1 setSelected:YES];
buttonImage = [UIImage imageNamed:@"Map Tab.png"];
selectedImage = [UIImage imageNamed:@"Map Tab Selected.png"];
btn2 = [UIButton buttonWithType:UIButtonTypeCustom];
btn2.frame = CGRectMake(160, self.view.frame.size.height-42, 160, 44);
[btn2 setImage:buttonImage forState:UIControlStateNormal];
[btn2 setImage:selectedImage forState:UIControlStateSelected];
[btn2 setTag:1];
[self.view addSubview:btn1];
[self.view addSubview:btn2];
[btn1 addTarget:self action:@selector(buttonClicked:) forControlEvents:UIControlEventTouchUpInside];
[btn2 addTarget:self action:@selector(buttonClicked:) forControlEvents:UIControlEventTouchUpInside];
}
And i create it like this:
tabBarController = [[CustomTabbar alloc]init];
tabBarController.view.frame=CGRectMake(0, 0, 320, 380);
[tabBarController viewDidAppear:NO];
mapsView = [[MapView alloc]init];
placesView = [[FavoritesList alloc]init];
//Suggestions from another forum (didn't work):
//[mapsView setWantsFullScreenLayout:YES];
//[placesView setWantsFullScreenLayout:YES];
mapsView.title=@"Maps";
placesView.title=@"Places";
placesView.mapView=mapsView;
mapsView.favorites=placesView;
NSArray *controllers = [NSArray arrayWithObjects:placesView, mapsView, nil];
[tabBarController setViewControllers:controllers];
[self addSubview:tabBarController.view];
Does someone know a fix for that?