UIBackButton背景图像未出现

2023-06-12移动开发问题
1

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

The End

相关推荐

硬件音量按钮更改应用程序音量
Hardware Volume buttons change in app volume(硬件音量按钮更改应用程序音量)...
2024-08-12 移动开发问题
10

Cocos2d - 如何检查不同层中对象之间的交集
Cocos2d - How to check for Intersection between objects in different layers(Cocos2d - 如何检查不同层中对象之间的交集)...
2024-08-12 移动开发问题
8

恢复游戏 cocos2d
Resume game cocos2d(恢复游戏 cocos2d)...
2024-08-12 移动开发问题
6

Cocos2D + 仅禁用 Retina iPad 图形
Cocos2D + Disabling only Retina iPad Graphics(Cocos2D + 仅禁用 Retina iPad 图形)...
2024-08-12 移动开发问题
10

如何将 32 位 PNG 转换为 RGB565?
How to convert 32 bit PNG to RGB565?(如何将 32 位 PNG 转换为 RGB565?)...
2024-08-12 移动开发问题
21

正确的 cocos2d 场景重启?
Proper cocos2d scene restart?(正确的 cocos2d 场景重启?)...
2024-08-12 移动开发问题
7