iOS8的UIAlertController标题总是为零 [英] UIAlertController title is always nil with iOS8
问题描述
我有一个问题,因为iOS8和Xcode 6.0.1,我的警报对话框的标题没有出现。所以我将我的UIAlertView更改为UIAlertController,但我遇到了同样的问题...
警报的标题总是为零,显示非常难看,因为我不知道有serparator行。
你知道为什么我有这个吗?
UIAlertController * alert = [UIAlertController alertControllerWithTitle:@title消息:@messagepreferredStyle:UIAlertControllerStyleAlert];
[alert addAction:[UIAlertAction actionWithTitle:@OKstyle:UIAlertActionStyleDefault handler:^(UIAlertAction * action){
[self dismissViewControllerAnimated:YES completion:nil];
}]];
[self presentViewController:alert animated:YES completion:nil];
但这是结果
< img src =https://i.stack.imgur.com/U31cE.pngalt =没有标题的Alertview>
(lldb)po alert.title
nil
(lldb)po alert.message
message
谢谢。
感谢@Myaaoonn解决了我的问题!
我刚刚从我的ViewController中删除了以下方法
类别类及其工作fyn!
- (void)setTitle:(NSString *)title
{
//我的代码
}
I have a problem since iOS8 and Xcode 6.0.1, the title of my alert dialogs doesn't appear. So I changed my UIAlertView to UIAlertController but I have the same issue...
The title of my alert is always to nil and the displaying is very ugly because I don't have the serparator lines.
Do you know why i have this ?
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"title" message:@"message" preferredStyle:UIAlertControllerStyleAlert];
[alert addAction:[UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
[self dismissViewControllerAnimated:YES completion:nil];
}]];
[self presentViewController:alert animated:YES completion:nil];
But this is the result
(lldb) po alert.title
nil
(lldb) po alert.message
message
Thank you.
I resolved my problem thanks to @Myaaoonn !
UIAlertView title does not display
I have just Remove the following method from my ViewController Category Class And its working fyn!
- (void)setTitle:(NSString *)title
{
// My Code
}
这篇关于iOS8的UIAlertController标题总是为零的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!