TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | Custom |
ReleasedLast Release | Apr 2017 |
Maintained by Stanislas Chevallier.
Popover created with simple navigation controller and view controller subclasses.
####How does it work?
Create subclasses of SYPopoverViewController
, add your subviews to popoverView
and position them inside:
- (void)updateFramesAndAlphas
{
[super updateFramesAndAlphas];
// here the self.popoverView.frame is up to date
}
You use SYPopoverNavigationController
to present subclasses of SYPopoverViewController
-(void)presentAsPopoverFromViewController:(SYPopoverViewController *)viewController animated:(BOOL)animated;
You can decide to use a transparent background (iOS 7+) with something like
[popoverNavController setBackgroundsColor:[UIColor clearColor]]
You know and control when a popover will be closed using the delegate methods
-(BOOL)popoverNavigationControllerShouldDismiss:(SYPopoverNavigationController *)popoverNavigationController;
-(void)popoverNavigationControllerWillDismiss:(SYPopoverNavigationController *)popoverNavigationController animated:(BOOL)animated;
-(void)popoverNavigationControllerWillPresent:(SYPopoverNavigationController *)popoverNavigationController animated:(BOOL)animated;
You define the size a view controller will have
BOOL showSmallMenu = ....
[popoverVC setPopoverSizeBlock:^(BOOL iPad, BOOL iPhoneSmallScreen) {
// don't need height > width
if(showSmallMenu)
return CGSizeMake(300, 300);
if(iPad)
return CGSizeMake(300, 600);
// iPhone and iPods with 3inches screens
if(iPhoneSmallScreen)
return CGSizeMake(300, 440);
// Other devices
return CGSizeMake(300, 500);
}];
Use it as you like in every project you want, redistribute with mentions of my name and don't blame me if it breaks :)
-- dvkch