iPhone - UIViewController 中的工具栏在显示后立即消失
我使用此代码在 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];
你知道问题出在哪里吗?
I use this code to display a one item Toolbar in UIViewController (which is pushed by UINavigationController). The toolbar shows up and immediately disappear:
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];
Do you know what the problem is?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这段代码在哪里?这里似乎没有什么不寻常的地方,所以要么与你调用它的位置有关,要么与之后发生的其他事情有关(例如稍后将toolbarHidden设置为YES或其他东西)
where is this code? Doesn't seem to be anything out of the ordinary here so either has to do with where you are calling it, or something else that happens afterwards (like setting toolbarHidden to YES later or something)