问题标签 [uiappearance]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
939 浏览

ios - iOS:无法更改 UIBarButtonItem 的颜色

我基本上有一个 ViewController,它是 UINavigationController 的根 ViewController。基本上我有一个 UIBarButtonItem,当用户按下它时,它的色调应该在红色和绿色之间切换。但是颜色好像没变。我的代码:

0 投票
3 回答
11029 浏览

iphone - UINavigationBar 自定义标题视图

我正在使用 iOS 5UINavigationBarUIAppearance协议来自定义我的所有导航栏。

这是我的自定义功能:

我有两个问题:

  • 首先是颜色不是clearColor黑色而是黑色。有什么建议么?

  • 标题视图根本没有出现。Ray Wenderlich[[rootViewController navigationItem] setTitleView: [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"miniLogo.png"]]]通过添加 a: in来展示如何做到这一点applicationDidFinishLaunching。但是这样做的问题是标题视图只会被添加到根视图控制器中。我正在使用 aUINavigationController并且当我厌倦了rootViewControllernavigationController(AppDelegate 中我的导航控制器的名称)替换时,我根本看不到标题视图。我该如何解决?为什么它不起作用customizeApperance()?使用外观的全部意义不就是只创建一次标题视图(就像我在函数上方所做的那样)并在所有导航栏中使其全局化吗?我怎样才能做到这一点?

0 投票
1 回答
4859 浏览

uitableview - 在 iOS5 中更改选定 UITableViewCells 的背景颜色

我的应用程序在不同的屏幕中显示分组的静态 UITableView。无论如何使用外观代理

或者

自定义选定单元格的背景颜色?基本上我需要修改

对于我的应用程序中的每个单元格,但我找不到要在代理对象中设置的正确属性。

顺便说一句,我也尝试过正常的方法(作为一个组静态表):

但它不起作用。有什么建议吗?

0 投票
1 回答
1485 浏览

objective-c - respondsToSelector fails for appearance proxy

I’m trying to detect an iOS 6-specific appearance method, by running respondsToSelector on the [UIBarButtonItem appearance]. However, it always returns NO for me, whatever selector I specify:

Actually using those methods works fine on their respective versions of iOS, but I can’t seem to detect which one is available to me. So how do I properly do that?

0 投票
3 回答
685 浏览

ios - 使用 UIAppearance 指定字体时,UINavigationBar 标题的行为异常(仅限 iOS 5)

我正在使用 UIAppearance 为我的应用程序中的 UINavigation 栏标题设置字体。

如果我不设置外观字体,标题会立即出现,正如预期的那样,并且它的呈现不是动画的。

但是,当我使用 UIAppearance 指定替代字体时,标题会出现(使用指定的字体),但会在 iOS 5 上加载时使用某种动画过渡出现。它有时也会停止(?)并且只显示标题的第一个字符. 如果我离开并再次返回,标题将正确显示。

我只在 iOS 5 上看到了这个问题,并且使用字体设置标题在 iOS 6 上表现正确。

在 iOS 5 的模拟器上也可以看到此问题,并且在模拟器中的 iOS 6 上再次正常运行。

我在AppDelegate中设置了外观,如下...

栏的标题在 viewDidLoad 中为每个 [tabbed] 视图设置,

有没有其他人看到这个问题,有解决办法吗?谢谢。

更新

我已经尝试在 viewDidLoad 中明确设置字体(就在设置标题之前),而不是使用 UIAppearance,但我仍然看到同样的问题,并且仍然只在 iOS 5 上。

0 投票
2 回答
1564 浏览

objective-c - 升级到 iOS 6 后 UISegmentedControl 的显示问题

自从升级到 iOS 6 后,我的所有 UISegmentedControl 都出现了显示问题,我对其进行了一些自定义。这就是它的样子。

UISegmentedControl

在 iOS 5 上完全没有问题,如果我在 iPhone 4 (iOS 5) 模拟器中运行,它显示正确。

这是我正在使用的代码:

我使用的图像应该没问题,它们有两种尺寸正常和@2x。告诉我你是否希望我提供一些细节。

[更新]

使用“正常” imageNamed:@"" 删除 cap inset 可调整大小的图像为我解决了这个问题。

0 投票
1 回答
717 浏览

background - 升级到 iOS 6 影响外观代理

我的应用程序使用以下方法实现了自定义分段控件背景图像:

在我更新到 XCode 4.5 和 iOS6 之前,它运行良好。现在是这样的: 在此处输入图像描述 您可以看到背景图像的大小已更改。有没有人有同样的问题?此外,某些屏幕的某些背景图像看起来更短。例如,在其中一个中,我有一个空格。

0 投票
1 回答
2717 浏览

ios5 - UIAppearance 的 setTitleTextAttributes 导致情节提要中设置的 UINavigationBar 标题在 iOS 6 中显示为椭圆形标题,但在 iOS 5 中没有

我一直在使用我认为是一些相当标准的 iOS 5 代码(这是stackoverflow 上接受的 7 倍答案),以便让我的 UINavigationBar 的标题以自定义字体显示。]

但我发现当我为 iOS5 构建的应用程序(以便它可以在 iOS5 和 iOS6 设备上运行)在 iOS6 模拟器上运行时,它省略了我的标题。

运行 iOS 6.0 的 iOS 4 英寸 Retina 显示器模拟器

以下是在 iOS 5.1 模拟器上运行的相同代码。

运行 iOS 5.1 的 iOS 3.5 英寸 Retinda 显示器模拟器

为清楚起见,以下是在我尝试在 iOS 6 上运行之前一直有效的相关代码。

0 投票
2 回答
8902 浏览

iphone - 使用 UIAppearance 分别自定义 UIBarButtonItem“完成”样式和“普通”样式

我知道如何自定义UIBarButtonItem使用-setBackgroundImage: forState: barMetrics:,但我想为UIBarButtonItemStyleDone和使用不同的图像UIBarButtonItemStylePlain

有没有办法使用UIAppearance协议来实现这一点?还是每次我想要“完成”样式按钮时都必须设置图像?

(我试着弄乱如下代码:

[[UIBarButtonItem appearance] setBackgroundImage:image forState:UIControlStateNormal barMetrics:UIBarButtonItemStyleDone];

但这只是将每个条形按钮设置为“完成”图像。)

谢谢!

0 投票
1 回答
8031 浏览

objective-c - iOS 6 appearance when contained in multiple classes

I’m using the appearanceWhenContainedIn method on certain UI elements that I want to customise in my iOS 6 app. The problem I found is that none of my customisations are applied if I try to provide more than one container class, like so:

The official docs say that the parameter for this method can be a nil-terminated list of multiple classes, but in my case it never works the way it should. Am I missing something here?