Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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 radutzan authored
Showing with 4 additions and 4 deletions.
  1. +1 −0  OLGhostAlertView.h
  2. +3 −4 OLGhostAlertView.m
1  OLGhostAlertView.h
View
@@ -13,5 +13,6 @@
- (id)initWithTitle:(NSString *)title message:(NSString *)message;
- (id)initWithTitle:(NSString *)title message:(NSString *)message timeout:(NSTimeInterval)timeout dismissible:(BOOL)dismissible;
- (void)show;
+- (void)hide;
@end
7 OLGhostAlertView.m
View
@@ -131,7 +131,7 @@ - (id)initWithTitle:(NSString *)title message:(NSString *)message timeout:(NSTim
constrainedSize.height = MAXFLOAT;
CGSize titleSize = [title sizeWithFont:[UIFont boldSystemFontOfSize:TITLE_FONT_SIZE] constrainedToSize:constrainedSize];
- CGSize messageSize;
+ CGSize messageSize = CGSizeZero;
if (message) {
messageSize = [message sizeWithFont:[UIFont systemFontOfSize:MESSAGE_FONT_SIZE] constrainedToSize:constrainedSize];
@@ -198,8 +198,7 @@ - (void)show
{
CGRect fullscreenRect = [self getScreenBoundsForCurrentOrientation];
- id appDelegate = [[UIApplication sharedApplication] delegate];
- UIWindow *window = [appDelegate window];
+ UIWindow *window = [[[UIApplication sharedApplication] delegate] window];
if (window.rootViewController.presentedViewController) {
[window.rootViewController.presentedViewController.view addSubview:self];
@@ -220,7 +219,7 @@ - (void)show
self.alpha = 1;
self.frame = CGRectMake(self.frame.origin.x, fullscreenRect.size.height - self.frame.size.height - bottomMargin, self.frame.size.width, self.frame.size.height);
} completion:^(BOOL finished){
- [NSTimer scheduledTimerWithTimeInterval:self.timeout target:self selector:@selector(hide) userInfo:nil repeats:NO];
+ [self performSelector:@selector(hide) afterDelay:self.timeout];
}];
}
Please sign in to comment.
Something went wrong with that request. Please try again.