ios - 在 UILabel 上使用外观代理是否会因为更改 UIAlertView 而拒绝我的应用程序?

标签 ios uilabel uialertview appstore-approval uiappearance

我希望自定义应用程序中的所有字体,并且一直在使用 [UILabel Appearance] API,因为它看起来是阻力最小的路径。 我注意到这也会影响 UIAlertView 内部的标签(如预期),但我也知道自定义警报 View 可能会导致应用被拒绝。

有没有人有这方面的经验?我是否应该创建自己的 UILabel 子类,然后手动将其应用到应用程序中的每个标签?

最佳答案

UILabel 类符合 UIAppearanceContainer 协议(protocol),查看 UILabel.h 发现其所有属性均未标记 UI_APPEARANCE_SELECTOR,这是使用 UIAppearance 的前提条件。因此,您需要创建 UILabel 子类,如下所示。

@interface SmallLabel : UILabel

@end

@implementation SmallLabel

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
}
  return self;
}

@结束

我想你也可以在你的子类中尝试这样的东西:

UIFont *newFont = [UIFont fontWithName:@"YourFontName" size:self.font.pointSize];
self.font = newFont

关于ios - 在 UILabel 上使用外观代理是否会因为更改 UIAlertView 而拒绝我的应用程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24614652/

相关文章:

ios - 在 OpenGL ES 2.0 中从一个非 2 的幂纹理复制到另一个纹理

ios - UILabel字体需要花费时间才能更新

ios - 使 UILabel 以 45 度角快速交叉背景色

ios - UILabel 中文本之前和之后的行

IOS UIAlertView 未显示

ios - UIAlertView + TextField = 错误?

android - phonegap 3.3.0 中的本地通知

ios - 使用 Google Sign In 和 SwiftUI 检查用户身份验证

ios - 带有层角半径和阴影的 UILabel

objective-c - 在异步 HTTP 请求的 completionHandler 中更新 View 时出现延迟