We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
楼主你是如何兼容IOS7下横屏的,貌似会显示旋转逆时针90度的。你是怎么解决这个问题的?核心代码是?
The text was updated successfully, but these errors were encountered:
// 侦听屏幕旋转 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(willRotateWithNoti:) name:UIDeviceOrientationDidChangeNotification object:nil]; - (void)willRotateWithNoti:(NSNotification *)noti { [UIView animateWithDuration:0.25 animations:^{ self.frame = CGRectMake(0, 0, ScreenSize.width, ScreenSize.height); }]; } - (void)layoutSubviews { [super layoutSubviews]; // 重新布局对话框视图 self.dialogView.centerX = self.centerX; self.dialogView.centerY = self.centerY; [self.dialogView layoutIfNeeded]; } - (void)dealloc { [[NSNotificationCenter defaultCenter] removeObserver:self]; }
self.translatesAutoresizingMaskIntoConstraints = NO; NSArray *hConstraint = [NSLayoutConstraint constraintsWithVisualFormat:@"H:|-0-[maskView]-0-|" options:0 metrics:nil views:@{@"maskView":self}]; [self.frontWindow addConstraints:hConstraint]; NSArray *vConstraint = [NSLayoutConstraint constraintsWithVisualFormat:@"V:|-0-[maskView]-0-|" options:0 metrics:nil views:@{@"maskView":self}]; [self.frontWindow addConstraints:vConstraint]; // 然后再布局,这是必写的 - (void)layoutSubviews { [super layoutSubviews]; // 重新布局对话框视图 self.dialogView.centerX = self.centerX; self.dialogView.centerY = self.centerY; [self.dialogView layoutIfNeeded]; }
可以参考本项目的XFMaskView类,如有对你帮助,可以Star
XFMaskView
Sorry, something went wrong.
No branches or pull requests
楼主你是如何兼容IOS7下横屏的,貌似会显示旋转逆时针90度的。你是怎么解决这个问题的?核心代码是?
The text was updated successfully, but these errors were encountered: