问题描述
我遇到的问题是我的UIBack按钮没有出现,我不确定是什么导致它。
i'm having a problem with my UIBackbutton not appearing and i'm not sure what is causing it.
这是我制作后退按钮图像的代码,它在我的第一个ViewController中:
This is my code for making the back button image, it is in my first ViewController :
UIImage *backButtonHomeImage = [[UIImage imageNamed:@"backButtonImage"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0, 0, 0)];
[[UIBarButtonItem appearance] setBackButtonBackgroundImage:backButtonHomeImage forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
当你第一次进入下一个视图(由一个按钮的segue完成)时,按钮不是可见,但返回的文字是可见的。一旦我点击后退按钮,图像就会出现,下次我点击它时就会出现。
When you first enter the next view (done by a segue from a button) the button isn't visible but the text to go back is visible. Once i've hit the back button the image appears and it stays appeared on the next time i click it.
我不确定这是否是一个问题要做使用我的代码,或者它所在的文件,或者它是否和iOS 7有问题。
I'm not sure if this is an issue to do with my code, or the file it's in or if it's and iOS 7 problem.
推荐答案
使用UIBarButtonItem可能会有更多的运气显式设置后退按钮背景。
You may have more luck using a UIBarButtonItem and setting the back button background explicitly.
外观代理在我自己尝试使用iOS 7的后退按钮时一直不可靠。我遇到了同样的问题背景没有正确显示第一次显示按钮。
The appearance proxy has been unreliable in my own attempts to get a back button working with iOS 7. I experienced the same issue with the background not showing up properly first time showing the button.
这篇关于UIBackButton背景图像没有出现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!