I wa开发者_Go百科nt to know if it is possible to add an UIButton
in UITabBar
on the iPad. If so, please let me know.
this is fairly straight forward if you look at the docs suggested by @Kyle the Unruly.
Here's an example of adding a built in button and your own image:
UIBarButtonItem * viewSnapShotButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCamera target:self action:@selector(snapShotButtonPressed:)];
UIBarButtonItem * fontButton = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"Font.png"] style:UIBarButtonItemStylePlain target:self action: @selector(fontSize:)];
// Add buttons to the tab bar
NSMutableArray *topCentreItems = [[NSMutableArray alloc] init];
UITabBar *topCentreTabBar = [[UITabBar alloc] initWithFrame:CGRectMake(0, 0, 120, 75];
[topCentreItems addObject:viewSnapShotButton];
[topCentreItems addObject:fontButton];
topCentreTabBar.items = topCentreItems;
精彩评论