iOS - 为什么我的 UIAlertView 上的底部项目是粗体?

标签 ios objective-c uialertview

为什么我的 UIAlertView 上的最后一项是粗体?

bold entry

我注意到这发生在我的所有警报 View 上,无论天气与否,我有一个 cancelButtonTitle 或我在警报 View 中有多少项目。

有谁知道为什么会这样以及我如何才能使所有标题均匀?

- (IBAction)showGender:(id)sender {
UIAlertView *genAlert = [[UIAlertView alloc] initWithTitle:@"Select gender."
                                                   message:nil
                                                  delegate:self
                                         cancelButtonTitle:nil
                                         otherButtonTitles:@"Male", @"Female", @"Transgender", @"Unknown", nil];
genAlert.tag = 4;
[genAlert show];

}

最佳答案

如果没有设置取消按钮,Apple 会将其设置为 numberOfButtons - 1。

尝试将 cancelButtonIndex 设置为 -1,看看是否有帮助。

W

编辑:这很痛苦。自 iOS7 以来,我一直在使用 UIAlertView 时遇到很多样式问题,特别是无法像以前那样对其进行样式设置。为了提供帮助,我在 github 上提供了一些文件。只需将它们放入您的项目中,您将拥有一个可以完全自定义的 UIAlertView 的克隆。

https://github.com/awgeorge/WGAlertView

W

关于iOS - 为什么我的 UIAlertView 上的底部项目是粗体?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23666081/

相关文章:

ios - Swift:我必须调用 Facebook 登录按钮两次才能获取 FBSDKAccessToken

ios - PFQuery缓存一直为空

ios - 我如何在 iOS 中读取 ptr_refs 给出的引用?

ios - JWPlayer 中的总时间和耗时 - Objective-C

ios - CocoaPods 不链接库

ios - 用选择器覆盖方法“tableview :cellForRowAtIndexPath

objective-c - NSURL 在模拟器中为空,但在 iPad 上没问题

cocoa - 当警报 View 关闭时,右侧导航栏按钮会移动

autolayout - UIAlertView 给出约束错误

ios - 带有图像和文本的 UIAlertView