diff --git a/ios/Classes/Api/MOP_showBotomSheetModel.m b/ios/Classes/Api/MOP_showBotomSheetModel.m index 8c0922b..f91426b 100644 --- a/ios/Classes/Api/MOP_showBotomSheetModel.m +++ b/ios/Classes/Api/MOP_showBotomSheetModel.m @@ -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;