Created
February 8, 2012 04:53
-
-
Save jakemoore/1765535 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void) show | |
{ | |
[[NSRunLoop currentRunLoop] runMode: NSDefaultRunLoopMode beforeDate:[NSDate date]]; | |
TSAlertViewController* avc = [[[TSAlertViewController alloc] init] autorelease]; | |
avc.view.backgroundColor = [UIColor clearColor]; | |
// $important - the window is released only when the user clicks an alert view button | |
TSAlertOverlayWindow* ow = [[TSAlertOverlayWindow alloc] initWithFrame: [UIScreen mainScreen].bounds]; | |
ow.alpha = 0.0; | |
ow.backgroundColor = [UIColor clearColor]; | |
ow.rootViewController = avc; | |
[ow makeKeyAndVisible]; | |
// fade in the window | |
[UIView animateWithDuration: 0.2 animations: ^{ | |
ow.alpha = 1; | |
}]; | |
// add and pulse the alertview | |
// add the alertview | |
[avc.view addSubview: self]; | |
[self sizeToFit]; | |
self.center = CGPointMake( CGRectGetMidX( avc.view.bounds ), CGRectGetMidY( avc.view.bounds ) );; | |
self.frame = CGRectIntegral( self.frame ); | |
[self pulse]; | |
if ( self.style == TSAlertViewStyleInput ) | |
{ | |
[self layoutSubviews]; | |
[self.inputTextField becomeFirstResponder]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment