Skip to content

Commit e19637f

Browse files
committed
fix multi line label on button display problem
1 parent baff6d9 commit e19637f

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

SCLAlertView/SCLButton.m

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ - (void)setTitle:(NSString *)title forState:(UIControlState)state
7171
// Update title frame.
7272
[self.titleLabel sizeToFit];
7373

74+
// Update button frame
75+
[self layoutIfNeeded];
76+
7477
// Get height needed to display title label completely
7578
CGFloat buttonHeight = MAX(self.titleLabel.frame.size.height, MIN_HEIGHT);
7679

SCLAlertViewExample/ViewController.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ - (IBAction)showSuccess:(id)sender
4747
{
4848
SCLAlertView *alert = [[SCLAlertView alloc] initWithNewWindow];
4949

50-
SCLButton *button = [alert addButton:@"First Button" target:self selector:@selector(firstButton)];
50+
SCLButton *button = [alert addButton:@"You have not saved your Submission yet. Please save the Submission before accessing the Responses list. Blah de blah de blah, blah. Blah de blah de blah, blah.Blah de blah de blah, blah.Blah de blah de blah, blah.Blah de blah de blah, blah.Blah de blah de blah, blah." target:self selector:@selector(firstButton)];
5151

5252
button.buttonFormatBlock = ^NSDictionary* (void)
5353
{

0 commit comments

Comments
 (0)