为什么添加到我的导航项的按钮看起来像是不活动的?
我有一个带有 splitViewController 的 iPad 应用程序。在我的 RootViewController 中 我添加按钮来编辑项目列表并添加新项目,
- (void)viewDidLoad
{
[super viewDidLoad];
self.clearsSelectionOnViewWillAppear = NO;
self.contentSizeForViewInPopover = CGSizeMake(320.0, 500.0);
// Configure the Edit button
[[self navigationItem] setLeftBarButtonItem:[self editButtonItem]];
// Configure the Add button
UIBarButtonItem * addButton = [[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemAdd
target:self
action:@selector(add)];
[[self navigationItem] setRightBarButtonItem:addButton];
[addButton release];
}
它工作正常。按钮点击。调用选择器。但按钮看起来像是处于非活动状态(灰色)。标题也是灰色的。为什么?
我需要做什么才能给他们一个标准布局?
I have an iPad app with splitViewController. In my RootViewController
i add buttons to edit list of items and to add a new item
- (void)viewDidLoad
{
[super viewDidLoad];
self.clearsSelectionOnViewWillAppear = NO;
self.contentSizeForViewInPopover = CGSizeMake(320.0, 500.0);
// Configure the Edit button
[[self navigationItem] setLeftBarButtonItem:[self editButtonItem]];
// Configure the Add button
UIBarButtonItem * addButton = [[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemAdd
target:self
action:@selector(add)];
[[self navigationItem] setRightBarButtonItem:addButton];
[addButton release];
}
it work fine. Buttons taps. Call selectors. But buttons looks like they is inactive (grayed). Title is also gray. Why?
What i need to do to give them a standard layout?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
可能是针对这一行的。注释这一行
self.clearsSelectionOnViewWillAppear = NO;
may be this is for this line.Comment this line
self.clearsSelectionOnViewWillAppear = NO;
从屏幕截图来看,BarButtonItems 的颜色是 UISplitViewController 的正确且默认的颜色。
如果您想自定义 BarButtonItems 的颜色,您可以通过提供会修改按钮颜色的tintColor 来实现。
From your screen shot the colours of the BarButtonItems are the correct and default colours of the UISplitViewController.
if you would like to customize the colour of the BarButtonItems you can do so by providing a tintColor which will modify the colour the button.