UIBackButton Background Image not appearing(UIBackButton背景图像未出现)
问题描述
我的 UIBackbutton 没有出现有问题,我不确定是什么原因造成的.
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];
当您第一次进入下一个视图时(通过按钮的转场完成),按钮不可见,但要返回的文本可见.一旦我点击后退按钮,图像就会出现,并且在我下次点击它时会一直出现.
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背景图像未出现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:UIBackButton背景图像未出现
基础教程推荐
- iOS4 创建后台定时器 2022-01-01
- 从 UIWebView 访问元数据 2022-01-01
- UINavigationItem 的持久 rightBarButtonItem 属性 2022-01-01
- EditText 中的 setHintTextColor() 2022-01-01
- Firebase 云消息传递令牌未生成 2022-01-01
- 更改 UITableView 部分标题的颜色 2022-01-01
- Android - 如何在runOnUiThread 中将数据传递给Runnable? 2022-01-01
- 在视图控制器的宽度上水平均匀分布 UIButton 的最简单方法? 2022-01-01
- 在 iOS 7 下 CCMenu 错位 2022-01-01
- UINavigationBar 隐藏按钮文本 2022-01-01