I have a universal tabbed app targetting ios 6 with 4 tabs. Almost ready to release, and I started to look at the latest and greatest ways to support iAds. After looking at the iAdSuite demo project from Apple, it seems as though using the BannerViewController to wrap my 4 UIViewControllers was the perfect solution.
And it works perfectly in so much as correctly displaying iAds.
However, since making the change my tab bar no longer has images/icons displayed. I've gone through the BannerViewController code line by line but I can't see anything that appears to be overriding the image setting.
The changes I made were:
- Add BannerViewController.h & .m to my project.
- #import < iAd/iAd.h> in each of my 4 UIViewControllers.
- Modify the AppDelegate code that sets up my tab view controller so that it changed:
from
self.tabBarController = [[UITabBarController alloc] init];
self.tabBarController.delegate = self;
self.tabBarController.viewControllers = @[viewController1, viewController2, viewController3, viewController4];
to
self.tabBarController = [[UITabBarController alloc] init];
self.tabBarController.delegate = self;
self.tabBarController.viewControllers = @[
[[BannerViewController alloc] initWithContentViewController:viewController1],
[[BannerViewController alloc] initWithContentViewController:viewController2],
[[BannerViewController alloc] initWithContentViewController:viewController3],
[[BannerViewController alloc] initWithContentViewController:viewController4]
];
In each of my 4 view controllers I have the following code in the initWithNibName method (with the appropriate title and image names:
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
self.title = NSLocalizedString(@"Library", @"Library");
self.tabBarItem.image = [UIImage imageNamed:@"96-book"];
}
return self;
}
With the original code, titles and images work as expected. With the modified code, I get the title but no image, just a black button. Has anyone come across this before?
Note I tried this out in the Apple sample app and can't get images to display there either, the sample app targets iOS5 and my app targets iOS6.