fix 分享视图横竖屏切换时现实异常问题
parent
5df1a9e0de
commit
69d26d667e
|
@ -88,6 +88,7 @@ returnInsets = inset;\
|
|||
[self.contentView addSubview:self.collectionView];
|
||||
self.collectionView.frame = CGRectMake(0, 0, frame.size.width, 100);
|
||||
|
||||
[self p_addNotifications];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
@ -96,6 +97,18 @@ returnInsets = inset;\
|
|||
return [[self alloc] initWithFrame:[UIScreen mainScreen].bounds];
|
||||
}
|
||||
|
||||
- (void)p_addNotifications {
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(deviceOrientationDidChange) name:UIDeviceOrientationDidChangeNotification object:nil];
|
||||
}
|
||||
|
||||
- (void)deviceOrientationDidChange {
|
||||
CGFloat screenWidth = [UIScreen mainScreen].bounds.size.width;
|
||||
CGFloat currentWidth = self.frame.size.width;
|
||||
if (screenWidth != currentWidth) {
|
||||
[self removeFromSuperview];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)show {
|
||||
if (self.superview) {
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue