diff --git a/TSPopover/TSPopoverController.m b/TSPopover/TSPopoverController.m index 2e2674f..ad5fbbc 100644 --- a/TSPopover/TSPopoverController.m +++ b/TSPopover/TSPopoverController.m @@ -57,6 +57,8 @@ - (id)init { screenRect.size.height = screenRect.size.height-20; titleLabelheight = 0; + + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(orientationChanged:) name:UIDeviceOrientationDidChangeNotification object:nil]; } return self; } @@ -208,6 +210,11 @@ - (void)view:(UIView*)view touchesBegan:(NSSet*)touches withEvent:(UIEvent*)even [self dismissPopoverAnimatd:YES]; } +- (void)orientationChanged:(NSNotification *)notification +{ + [self dismissPopoverAnimatd:NO]; +} + - (void) dismissPopoverAnimatd:(BOOL)animated { @@ -240,6 +247,8 @@ - (void) dismissPopoverAnimatd:(BOOL)animated } } + + [[NSNotificationCenter defaultCenter] removeObserver:self]; } - (CGRect) contentFrameRect:(CGRect)contentFrame senderPoint:(CGPoint)senderPoint