UIBackButton背景图像未出现 [英] UIBackButton Background Image not appearing

查看:26
本文介绍了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背景图像未出现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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