【发布时间】:2011-06-14 14:14:39
【问题描述】:
我使用此代码在 UIViewController 中显示一个项目工具栏(由 UINavigationController 推送)。工具栏出现并立即消失:
UIBarButtonItem * logoutButton = [[UIBarButtonItem alloc] initWithTitle:@"Log out" style:UIBarButtonItemStylePlain target:self action:nil];
NSMutableArray * arr = [NSMutableArray arrayWithObjects:logoutButton, nil];
[self setToolbarItems:arr animated:NO];
[self.navigationController setToolbarHidden:NO animated:NO];
你知道问题出在哪里吗?
【问题讨论】:
-
这段代码在哪里?这里似乎没有什么特别之处,所以要么与你调用它的位置有关,要么与之后发生的其他事情有关(比如稍后将 toolbarHidden 设置为 YES 或其他东西)
-
我找到了问题所在。在我的应用程序中有一个地方可以将工具栏设置为隐藏 UINavigationController 堆栈上的所有视图控制器。
-
@Jess:你能把你的评论作为答案吗,因为我想提出这个问题|回答|但我自己做不到。谢谢。
标签: iphone objective-c uinavigationcontroller toolbar