Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 24 additions & 5 deletions URBAlertView.m
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,10 @@ - (void)initialize {
[self build];
}

- (void)dealloc
{
}

- (void)setHandlerBlock:(URBAlertViewBlock)block {
self.block = block;
}
Expand Down Expand Up @@ -1150,7 +1154,7 @@ - (void)showOverlay:(BOOL)show {
self.overlay = [URBAlertWindowOverlay new];
URBAlertWindowOverlay *overlay = self.overlay;
overlay.opaque = NO;
overlay.alertView = self;
// overlay.alertView = self;
overlay.frame = self.window.bounds;
overlay.alpha = 0.0;
}
Expand Down Expand Up @@ -1284,15 +1288,30 @@ - (void)keyboardWillHide:(NSNotification *)note {
}

- (void)adjustToKeyboardBounds:(CGRect)bounds {
CGRect screenBounds = [[UIScreen mainScreen] bounds];
CGFloat height = CGRectGetHeight(screenBounds) - CGRectGetHeight(bounds);
CGRect screenBounds = [[UIScreen mainScreen] bounds];
CGRect frame = self.frame;
frame.origin.y = (height - CGRectGetHeight(self.bounds)) / 2.0;
CGFloat height = CGRectGetHeight(screenBounds) - CGRectGetHeight(bounds);
UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation;
if (UIDeviceOrientationIsLandscape(orientation)) {
height = CGRectGetWidth(screenBounds)-CGRectGetWidth(bounds);
frame.origin.x = (height - CGRectGetWidth(self.bounds)) /2.0 ;
if (bounds.origin.x == 0) {
frame.origin.x = frame.origin.x +CGRectGetWidth(bounds);
}
}
else
{
frame.origin.y = (height - CGRectGetHeight(self.bounds)) / 2.0;
if (bounds.origin.y == 0) {
frame.origin.y += CGRectGetHeight(bounds);
}
}

if (CGRectGetMinY(frame) < 0) {
NSLog(@"warning: dialog is clipped, origin negative (%f)", CGRectGetMinY(frame));
}



[UIView animateWithDuration:0.2 delay:0 options:UIViewAnimationOptionBeginFromCurrentState animations:^{
self.frame = frame;
} completion:nil];
Expand Down