UIToolbar项目消失 - ios6中的奇怪的错误 [英] UIToolbar items disappear - Weird bug in ios6

查看:131
本文介绍了UIToolbar项目消失 - ios6中的奇怪的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是当前的设置。

我有navigationController的工具栏有5个按钮,点击它们隐藏工具栏2秒,然后再次显示工具栏(除了第5个按钮 - 具有按钮的操作表(ACTION& CANCEL))。

I have the navigationController's toolbar with 5 buttons, and tapping on them hides the toolbar for 2 seconds, and then shows the toolbar again (except the 5th button - which brings up an actionsheet with buttons (ACTION & CANCEL)).

点击1-4按钮时,我会执行 self.navigationController.toolbarHidden = YES; ,并在 2秒后,我设置 self.navigationController.toolbarHidden = NO; 回到工具栏,一切都很好。

On tapping on the 1-4 buttons, I do a self.navigationController.toolbarHidden = YES; and after exactly 2 seconds, I set the self.navigationController.toolbarHidden = NO; and this brings back the toolbar, and everything's fine.

点按第5个按钮即可显示操作表。

On tapping the 5th button, which brings up action sheet.


  1. 我点击CANCEL actionsheet => actionSheet dismissed =>工具栏很好。

  2. 如果我点击ACTION按钮,我做一个 self.navigationController.toolbarHidden = / code>和2秒后... self.navigationController.toolbarHidden = NO;
    但现在...工具栏按钮是GONE。

进一步调查...

我可以看到toolbarutton 的值设置为0.

I can see the the toolbarButtons seem to have their alpha values set to 0.

我不知道为什么设置工具栏项目的alpha在操作表操作后,value = 0。

I have no idea why the toolbar items' alpha are set to value = 0 after actionsheet operation.

任何人都可以告诉我这个的根本原因?

Can anyone tell me the root cause for this?

推荐答案

你试过将工具栏项数组设置为nil?我有这个相同的问题,原来是,当你设置工具栏的项目时,检查一下似乎工作:

Have you tried setting the toolbar items array to nil? I had this same problem and it turned out that putting a check around when you set the toolbar's items seemed to work:

if ([self.navigationController.toolbar.items count] > 0) {
   [self.navigationController.toolbar setItems:nil];
}

[self.navigationController.toolbar setItems:toolbarItems]; //toolbarItems is your array of UIBarButtonItems.

这篇关于UIToolbar项目消失 - ios6中的奇怪的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆