问题
It appears that UIAlertView is not compatible with iOS8. I've just discovered that all my multiline UIAlertViews become truncated one-liners in iOS8 (for the message). In iOS7 they are displayed correctly with multilines.
iOS7:
iOS8:
[[[UIAlertView alloc] initWithTitle:@"Namn saknas"
message:@"Du måste fylla i ditt namn för att kommentera"
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles: nil] show];
I'm aware of that UIAlertController should be used in iOS8 and later and that UIAlertView is deprecated as of iOS8.
BUT shouldn't still work as previously (i.e iOS7) in iOS8? If not, shouldn't it have been deprecated from iOS7?
Or I'm I missing something here? These is not just a pseudo issue over how things should be - I have over 40 places in the code with alert views and it's not in the timetable to change all these now...
回答1:
This issue is now resolved - got an answer from Apple Engineering:
"Your sample project declares a category on UILabel which overrides -intrinsicContentSize. Overriding UIKit methods leads to unpredictable behavior."
So I removed the override and everything worked fine.
Override was:
-(CGSize)intrinsicContentSize {
CGSize s = [super intrinsicContentSize];
s = CGSizeMake(s.width, s.height + 4);
return s;
}
来源:https://stackoverflow.com/questions/26468862/uialertview-automatic-newline-gone-in-ios8