问题
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.
回答1:
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
}
回答2:
Try calling the UIAlertView like this:
[[[UIAlertView alloc] initWithTitle:<#title#>
message:<#msg#>
delegate:nil
cancelButtonTitle:<#cancel button#>
otherButtonTitles:<#buttons#>,nil] show];
Does the title still not show?
来源:https://stackoverflow.com/questions/26253231/uialertcontroller-title-is-always-nil-with-ios8