Fixed: if a CPAlert message was 3 lines or more and there was no informative text, the upper half of the CPAlert buttons would not react to clicks as the blank informative label partially covered them.

This commit is contained in:
Alexander Ljungberg
2010-08-21 17:47:03 -04:00
parent fbd5a78cf0
commit e766a2c945
2 changed files with 7 additions and 3 deletions
+2
View File
@@ -365,6 +365,8 @@ CPCriticalAlertStyle = 2;
[_messageLabel setFrame:CGRectMake(inset.left, inset.top, textWidth, messageSize.height + sizeWithFontCorrection)];
[_informativeLabel setFrame:CGRectMake(inset.left, CGRectGetMaxY([_messageLabel frame]) + informativeOffset, textWidth, informativeSize.height + sizeWithFontCorrection)];
// Don't let an empty informative label partially cover the buttons.
[_informativeLabel setHidden:!informationString];
var aRepresentativeButton = _buttons[0],
buttonY = MAX(CGRectGetMaxY([_alertImageView frame]), CGRectGetMaxY(informationString ? [_informativeLabel frame] : [_messageLabel frame])) + buttonOffset; // the lower of the bottom of the text and the bottom of the icon.
+5 -3
View File
@@ -25,7 +25,10 @@
"Theorise", "Cancel"],
[@"Snakes. Why did it have to be snakes?",
nil,
"Torch", "Cancel"]
"Torch", "Cancel"],
[@"Sometimes a message can be really long and just appear to go on and on. It could be a speech. It could be the television.",
nil,
"Off", "Cancel"]
];
messageIndex = 0;
@@ -69,12 +72,11 @@
if (![variations count])
return;
var variation = variations[0],
message = messages[messageIndex],
alert = [[CPAlert alloc] init];
messageIndex = 1 - messageIndex;
messageIndex = (messageIndex + 1) % messages.length;
[variations removeObjectAtIndex:0];
[alert setDelegate:self];