Im working on an iPhone app, not using IB, and programmatically created a UITabbar with three items in a UIViewController in a view based application, I used one delegate method, that wont work without the last line in the snippet below( setDelegate method). I dont have a tabbarviewcontroller.
UITabBar *tabbar = [[UITabBar alloc] initWithFrame:CGRectMake(0, YMAX-60, XMAX, 40)];
NSMutableArray *items = [[NSMutableArray alloc] initWithCapacity:3];
[items addObject:[[[UITabBarItem alloc] initWithTitle:@"One" image:[UIImage imageNamed:@"img04.png"] tag:0] autorelease]];
[items addObject:[[[UITabBarItem alloc] initWithTitle:@"Two" image:[UIImage imageNamed:@"img.png"] tag:1] autorelease]];
[items addObject:[[[UITabBarItem alloc] initWithTitle:@"Three" image:[UIImage imageNamed:@"img-01.png"] tag:2] autorelease]];
tabbar.items = items;
tabbar.alpha = 1.0;
tabbar.userInteractionEnabled = YES;
[tabbar setBackgroundColor:[UIColor blueColor]];
[tabbar setDelegate:self];
Is it possible to eliminate this warning? I am not a Cocoa programmer, sometimes need to work on iphone.
To get rid of this warning you must implement the one required method of the UItabBarDelegate protocol.
UITabBarDelegate_Protocol
You can see that the required method is:
implement that and you'll be fine.
Don't forget to declare in your header file that you implement the protocol.