Git Product home page Git Product logo

sypopover's Introduction

SYPopover

Popover created with simple navigation controller and view controller subclasses.

####How does it work?

  1. 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
     }
    
  2. You use SYPopoverNavigationController to present subclasses of SYPopoverViewController

     -(void)presentAsPopoverFromViewController:(SYPopoverViewController *)viewController animated:(BOOL)animated;
    
  3. You can decide to use a transparent background (iOS 7+) with something like

     [popoverNavController setBackgroundsColor:[UIColor clearColor]]
    
  4. 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;
    
  5. 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);
     }];
    

License

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

sypopover's People

Contributors

dvkch avatar

Watchers

SoftRoots avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.