为什么我的 UIAlertView
上的最后一项是粗体?
我注意到这发生在我的所有警报 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/