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

时间:2014-05-14 22:14:32

标签: ios objective-c uialertview

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

bold entry

我注意到这种情况发生在我的所有提醒视图中,无论天气如何,我都有cancelButtonTitle或警报视图中有多少项目。

有谁知道为什么会发生这种情况以及如何制作所有标题呢?

- (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];

}

1 个答案:

答案 0 :(得分:3)

如果未设置取消按钮,Apple会将其设置为numberOfButtons - 1.

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

w ^

编辑:那很痛苦。从iOS7开始,我对UIAlertView一直存在很多样式问题,特别是不能像以前那样设计样式。为了帮助我,我在github上提供了一些文件。只需将它们放入您的项目中,您就可以完全自定义UIAlertView的克隆。

https://github.com/awgeorge/WGAlertView

w ^