Skip to content

Commit 189a127

Browse files
committed
fix setter no working
1 parent 659d196 commit 189a127

2 files changed

Lines changed: 16 additions & 2 deletions

File tree

SIAlertView/SIAlertView.m

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -377,13 +377,17 @@ - (NSString *)message
377377
- (void)setAttributedTitle:(NSAttributedString *)attributedTitle
378378
{
379379
_attributedTitle = [attributedTitle copy];
380-
[self updateTitleLabel];
380+
if (self.isVisible) {
381+
[self updateTitleLabel];
382+
}
381383
}
382384

383385
- (void)setAttributedMessage:(NSAttributedString *)attributedMessage
384386
{
385387
_attributedMessage = [attributedMessage copy];
386-
[self updateMessageLabel];
388+
if (self.isVisible) {
389+
[self updateMessageLabel];
390+
}
387391
}
388392

389393
#pragma mark - Public

SIAlertViewExample/SIAlertViewExample/ViewController.m

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,8 @@ - (IBAction)alert2:(id)sender
160160
- (IBAction)alert3:(id)sender
161161
{
162162
SIAlertView *alertView = [[SIAlertView alloc] initWithTitle:nil message:@"Message3"];
163+
alertView.tintColor = [UIColor orangeColor];
164+
163165
[alertView addButtonWithTitle:@"Cancel"
164166
type:SIAlertViewButtonTypeCancel
165167
handler:^(SIAlertView *alertView) {
@@ -170,10 +172,18 @@ - (IBAction)alert3:(id)sender
170172
handler:^(SIAlertView *alertView) {
171173
NSLog(@"OK Clicked");
172174
}];
175+
alertView.tintColor = [UIColor greenColor];
173176
alertView.transitionStyle = SIAlertViewTransitionStyleDropDown;
174177
alertView.backgroundStyle = SIAlertViewBackgroundStyleSolid;
175178
alertView.defaultButtonBackgroundColor = [UIColor blackColor];
176179
alertView.cancelButtonBackgroundColor = [UIColor blackColor];
180+
alertView.seperatorColor = [UIColor colorWithWhite:1 alpha:1];
181+
alertView.viewBackgroundColor = [UIColor darkGrayColor];
182+
// alertView.messageAttributes = @{NSForegroundColorAttributeName : [UIColor lightGrayColor]};
183+
NSMutableDictionary *attributes = [alertView.messageAttributes mutableCopy];
184+
attributes[NSForegroundColorAttributeName] = [UIColor whiteColor];
185+
attributes[NSFontAttributeName] = [UIFont systemFontOfSize:30];
186+
alertView.attributedMessage = [[NSAttributedString alloc] initWithString:@"Message3" attributes:attributes];
177187

178188
alertView.willShowHandler = ^(SIAlertView *alertView) {
179189
NSLog(@"%@, willShowHandler3", alertView);

0 commit comments

Comments
 (0)