From bbe37a868969b272361aed58ee1aa58a48a9f8fe Mon Sep 17 00:00:00 2001 From: Nima Azimi Date: Sat, 25 Oct 2014 10:55:59 +0330 Subject: [PATCH] Fix not center aligned issue in landscape mode for both iOS7 and iOS8 --- RNBlurModalView.m | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/RNBlurModalView.m b/RNBlurModalView.m index f3d081a..67cb91c 100644 --- a/RNBlurModalView.m +++ b/RNBlurModalView.m @@ -134,8 +134,6 @@ + (UIView*)generateModalViewWithTitle:(NSString*)title message:(NSString*)messag view.height = messageLabel.bottom + padding; - view.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleRightMargin; - return view; } @@ -168,7 +166,7 @@ - (id)initWithViewController:(UIViewController*)viewController view:(UIView*)vie if (self = [self initWithFrame:CGRectMake(0, 0, viewController.view.width, viewController.view.height)]) { [self addSubview:view]; _contentView = view; - _contentView.center = CGPointMake(CGRectGetMidX(self.frame), CGRectGetMidY(self.frame)); + _contentView.center = CGPointMake(CGRectGetMidX(viewController.view.bounds), CGRectGetMidY(viewController.view.bounds)); _controller = viewController; _parentView = nil; _contentView.clipsToBounds = YES; @@ -193,7 +191,7 @@ - (id)initWithParentView:(UIView*)parentView view:(UIView*)view { if (self = [self initWithFrame:CGRectMake(0, 0, parentView.width, parentView.height)]) { [self addSubview:view]; _contentView = view; - _contentView.center = CGPointMake(CGRectGetMidX(self.frame), CGRectGetMidY(self.frame)); + _contentView.center = CGPointMake(CGRectGetMidX(parentView.bounds), CGRectGetMidY(parentView.bounds)); _controller = nil; _parentView = parentView; _contentView.clipsToBounds = YES;