2011-01-12 56 views

回答

1

如果你看@Kyle the Unruly建议的文档,这是相当直接的。

这里是添加一个内置的按钮和自己的形象的例子:

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; 
相关问题