为什么UIBarButtonItem显示为禁用?

4

我创建了一个非常简单的演示应用程序,展示了如何使用UINavigationController进行基本导航:

我有两个故事板。我的想法是允许在第一个故事板中,当用户点击UIBarButtonItem时,从第二个故事板中呈现一个视图控制器(B),然后能够关闭(B)并返回到(A)。

不确定我需要多么技术性,因为我只是困惑于当返回到(A)时,UIBarButtonItem的外观(在截图中看到的C)的问题。基本上,该按钮似乎被禁用了。

当我更改工具栏按钮以显示图像时,该图像的外观没有发生变化,并且基本上按预期工作。

有任何想法吗?

我点击UIBarButtonItem A,然后点击B,期望看到UIBarButtonItem的外观像A一样,但实际上它看起来像C。


看起来你遇到了与这个问题相同的问题 https://dev59.com/nqfja4cB1Zd3GeqPw4JB - trungduc
按钮看起来被禁用了,但它还能正常工作吗? - davidethell
是的,按钮有效。如果它真的被禁用了,那么问题就不会那么困惑且容易解决。然而,这只是看起来被禁用了,而且只有当按钮使用标题时才会如此。 - Johan
2个回答

0

0
For iPhone X support follow below things:

1. Enable Safearea to your ViewController's XIB or Storyboard's ViewController
2. Top Touchable controls (Button, textfield etc) should be top from SafeArea not from superview
3. Bottom Touchable controls (Button, textfield etc) should be bottom to SafeArea not from Superview.

If you are not following above things not sure touch (Top and Bottom) will work or not. If you follow all will work fine

1
抱歉,这不是iPhone X特定的问题。任何设备上都会出现相同的行为。 - Johan

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接