Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Improvements based on leberwurstsaft's and rlester's forks.

» Made public the -hide method (rlester)
» Code cleanup (leberwurstsaft)
» Fixed garbage value bug (leberwurstsaft)
  • Loading branch information...
commit 3a6d5d56ba3ed944ed894974142f39febbd16cb8 1 parent 4ed6d71
Radu Dutzan authored

Showing 2 changed files with 4 additions and 4 deletions. Show diff stats Hide diff stats

  1. +1 0  OLGhostAlertView.h
  2. +3 4 OLGhostAlertView.m
1  OLGhostAlertView.h
@@ -13,5 +13,6 @@
13 13 - (id)initWithTitle:(NSString *)title message:(NSString *)message;
14 14 - (id)initWithTitle:(NSString *)title message:(NSString *)message timeout:(NSTimeInterval)timeout dismissible:(BOOL)dismissible;
15 15 - (void)show;
  16 +- (void)hide;
16 17
17 18 @end
7 OLGhostAlertView.m
@@ -131,7 +131,7 @@ - (id)initWithTitle:(NSString *)title message:(NSString *)message timeout:(NSTim
131 131 constrainedSize.height = MAXFLOAT;
132 132
133 133 CGSize titleSize = [title sizeWithFont:[UIFont boldSystemFontOfSize:TITLE_FONT_SIZE] constrainedToSize:constrainedSize];
134   - CGSize messageSize;
  134 + CGSize messageSize = CGSizeZero;
135 135
136 136 if (message) {
137 137 messageSize = [message sizeWithFont:[UIFont systemFontOfSize:MESSAGE_FONT_SIZE] constrainedToSize:constrainedSize];
@@ -198,8 +198,7 @@ - (void)show
198 198 {
199 199 CGRect fullscreenRect = [self getScreenBoundsForCurrentOrientation];
200 200
201   - id appDelegate = [[UIApplication sharedApplication] delegate];
202   - UIWindow *window = [appDelegate window];
  201 + UIWindow *window = [[[UIApplication sharedApplication] delegate] window];
203 202
204 203 if (window.rootViewController.presentedViewController) {
205 204 [window.rootViewController.presentedViewController.view addSubview:self];
@@ -220,7 +219,7 @@ - (void)show
220 219 self.alpha = 1;
221 220 self.frame = CGRectMake(self.frame.origin.x, fullscreenRect.size.height - self.frame.size.height - bottomMargin, self.frame.size.width, self.frame.size.height);
222 221 } completion:^(BOOL finished){
223   - [NSTimer scheduledTimerWithTimeInterval:self.timeout target:self selector:@selector(hide) userInfo:nil repeats:NO];
  222 + [self performSelector:@selector(hide) afterDelay:self.timeout];
224 223 }];
225 224 }
226 225

0 comments on commit 3a6d5d5

Please sign in to comment.
Something went wrong with that request. Please try again.