Skip to content
This repository has been archived by the owner on Apr 7, 2023. It is now read-only.

Dismiss popover when device orientation changed #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 9 additions & 0 deletions TSPopover/TSPopoverController.m
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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
{
Expand Down Expand Up @@ -240,6 +247,8 @@ - (void) dismissPopoverAnimatd:(BOOL)animated
}

}

[[NSNotificationCenter defaultCenter] removeObserver:self];
}

- (CGRect) contentFrameRect:(CGRect)contentFrame senderPoint:(CGPoint)senderPoint
Expand Down