Coder Social home page Coder Social logo

kajinka13 / fppopover Goto Github PK

View Code? Open in Web Editor NEW

This project forked from alvises/fppopover

1.0 1.0 0.0 4.63 MB

FPPopover provides an alternative to the native iOS UIPopoverController, adding support for iPhone and additional opportunities to customize the look and feel of the popovers.

Home Page: http://www.gingerbeard.me

License: Other

C 0.90% Ruby 0.27% Objective-C 98.83%

fppopover's Introduction

FPPopover

This library provides an alternative to the native iOS UIPopoverController, adding support for iPhone and additional opportunities to customize the look and feel of the popovers.

The development started as first as a Mobiloud open source component, after some commits we realized was a appreciated library so I decided to continue the development, also the development is continuing thank to your feedbacks and pull requests!

Features

  • Works like UIPopoverController.
  • Runs on both iPhone and iPad.
  • Popover rendered using no images, only Quartz code.
  • Customize the look of popovers (color, dimensions).
  • Automatic orientation. It will find the best orientation and size for every situation.
  • Can draw popover with no arrows
  • Borderless popover
  • MIT License (you can use it for commercial apps, edit and redistribute).
  • Using ARC (see ARC-Support)

What you need

To use FPPopoverController you only need

  • FPPopoverController.m and .h (the controller)
  • FPPopoverView.m and .h
  • FPTouchView.m and .m
  • ARCMacros.h

That's it.

How to use it

Let's start with a simple example

-(IBAction)buttonClicked:(UIButton*)okButton
{
    //the view controller you want to present as popover
    YourViewController *controller = [[YourViewController alloc] init]; 

    //our popover
    FPPopoverController *popover = [[FPPopoverController alloc] initWithViewController:controller]; 
    
    //the popover will be presented from the okButton view 
    [popover presentPopoverFromView:okButton]; 

    //no release (ARC enable)
    //[controller release];
}

This will display a black popover with automatic arrow positioning and a maximum of 200x300 content size and no delegate messages.

The title of YourViewController (controller.title) will be presented on the top.

##Customize the size

Default content size is 200x300. This can be set using the following property

popover.contentSize = CGSizeMake(150,200);

This property defines a maximum boundary for content, but the actual content area displayed may vary according to the what is found to be the optimal size to fit the popover on the screen (e.g. when adjusting the layout from portrait to landscape mode).

##Customize the tint

  • FPPopoverBlackTint (default)
  • FPPopoverLightGrayTint
  • FPPopoverGreenTint
  • FPPopoverRedTint
popover.tint = FPPopoverRedTint;

Contact us if you need more tints!

##Force the arrow direction

If you need to force the arrow direction use the arrowDirection property

popover.arrowDirection = FPPopoverArrowDirectionUp;

##No arrow If you want a popover like a popup, with no arrow

popover.arrowDirection = FPPopoverNoArrow;

##No title

//the view controller you want to present as popover
YourViewController *controller = [[YourViewController alloc] init]; 
controller.title = nil;

##Borderless popover

popover.border = NO;
popover.tint = FPPopoverWhiteTint;

Transparency

If you want to change alpha channel and handle the transparency of the popover

popover.alpha = 0.8;

transparent popover

##Delegate messages

Set your delegate

YourViewController *controller = [[YourViewController alloc] init]; 
FPPopoverController *popover = [[FPPopoverController alloc] initWithViewController:controller]; 
popover.delegate = controller;
....

In this case we are setting up the YourViewController as our popover delegate.

####Know when a new popover is displayed

- (void)presentedNewPopoverController:(FPPopoverController *)newPopoverController 
          shouldDismissVisiblePopover:(FPPopoverController*)visiblePopoverController;

Use this delegate method to know when a new different popover is displayed. If you want to dismiss the old popover, and release it, send the dismiss message inside this method.

- (void)presentedNewPopoverController:(FPPopoverController *)newPopoverController 
          shouldDismissVisiblePopover:(FPPopoverController*)visiblePopoverController
{
    [visiblePopoverController dismissPopoverAnimated:YES];
    [visiblePopoverController autorelease];
}

####Know when the popover is dismissed

    - (void)popoverControllerDidDismissPopover:(FPPopoverController *)popoverController;

Use this delegate method to know when the popover is dismissed. This could happen when the user taps outside the popover or when a dismiss message is sent by other actions.

Contributors

Thank you to the following wonderful people for contributing: alphabetically sorted

fppopover's People

Contributors

johnkdoe avatar kajinka13 avatar lexrus avatar markrickert avatar psaccomani avatar romanr avatar

Stargazers

 avatar

Watchers

 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.