【问题标题】:Why are all my UIAlertView labels/text bold by default in iOS 8为什么我的所有 UIAlertView 标签/文本在 iOS 8 中默认为粗体
【发布时间】:2014-10-07 17:00:37
【问题描述】:

我搜索了这个,唯一的解决方案似乎来自 UIAlertViewDelegate。我不想这样做只是为了消除粗体文字。

我用来弹出警报视图的代码如下:

NSString* errPrompt = @"some text here, anything that will not show bold :)";
UIAlertView* alert = [[UIAlertView alloc] initWithTitle:title
                                                message:errPrompt
                                                delegate:nil
                                       cancelButtonTitle:[self getUiText:"OK"]
                                       otherButtonTitles:nil];
[alert show];

【问题讨论】:

    标签: ios8 uialertview uialertviewdelegate


    【解决方案1】:

    这是 iOS 中的一个错误,会影响所有没有设置标题的警报。

    有趣的是,大多数标准 iOS 警报(如 App Store 中的)都不会受到影响。

    【讨论】:

      【解决方案2】:

      这适用于我在 iOS 8 上。只是标题中的空字符串,@"" 内没有空格。

        [[[UIAlertView alloc] initWithTitle:@""
           message:@"My message" 
           delegate:nil
           cancelButtonTitle:@"OK"
           otherButtonTitles:nil] show];
      

      【讨论】:

        【解决方案3】:

        当您没有设置警报标题时会发生这种情况。 (奇怪,我知道)

        将警报的标题设置为。如果你是空的。不想添加任何标题

        UIAlertController(title: "", message: "The alert message", preferredStyle: .alert)
        

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 2023-03-06
          • 2019-04-21
          • 2012-03-19
          • 1970-01-01
          • 2017-12-18
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多