简体   繁体   English

UiBarButtonItem背景图像直到第一次点击才显示

[英]UiBarButtonItem background image not showing until first tap

In my AppDelegate.m file I have created the following back button style: 在我的AppDelegate.m文件中,我创建了以下后退按钮样式:

    UIImage *backBtnImage = [UIImage imageNamed:@"back.png"];
    [[UIBarButtonItem appearance] setBackButtonBackgroundImage: backBtnImage forState: UIControlStateNormal barMetrics: UIBarMetricsDefault];
    [[UIBarButtonItem appearance] setBackButtonBackgroundImage: backBtnImage forState: UIControlStateHighlighted barMetrics: UIBarMetricsDefault];

For some reason the background image only shows on each view after the space where the button is is tapped once - it loads everytime for each view after that. 由于某种原因,背景图像仅显示在按钮被按下一次的空间之后的每个视图上 - 之后每次为每个视图加载。

I've tried cleaning the project but to no avail. 我试过清理这个项目,但无济于事。

嗯,如果你在你的模拟器上运行它,尝试重置内容和设置,如果这不起作用,我知道iOS设备有一些缓存问题,尝试更改实际文件和xcode中的引用中的照片name.png 。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM