【问题标题】:Is there a possibility to add button in UITabBar in IPad?是否有可能在 iPad 的 UITabBar 中添加按钮?
【发布时间】:2011-01-12 09:02:02
【问题描述】:

我想知道是否可以在 iPad 上的UITabBar 中添加UIButton。如果有,请告诉我。

【问题讨论】:

标签: ipad uibutton uitabbar


【解决方案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;

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-03-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-11
    • 1970-01-01
    • 1970-01-01
    • 2018-03-19
    相关资源
    最近更新 更多