Skip to content
Generic popover implementation for iOS with same API as the UIPopoverController for the iPad, but configurable with custom background and available for iPhone/iPhone4
Objective-C
Find file
Pull request Compare This branch is 27 commits ahead, 82 commits behind werner77:master.
Latest commit 2a42c75 Aug 27, 2012 @PaulSolt Merge pull request #11 from billpatterson/master
A bug fix and a trivial removal of a line of logging from production code.
Failed to load latest commit information.
Classes Merge pull request #11 from billpatterson/master Aug 27, 2012
WEPopover.xcodeproj Updated GCC Version to the latest LLVM. Aug 26, 2012
.gitignore Updated gitignore Apr 22, 2011
LICENSE Added license file Jan 25, 2011
MainWindow.xib echo Setting .bash_profile Jan 23, 2011
README.md Update README.md Aug 26, 2012
WEPopover-Info.plist Changed the app identifier so it clashes less with main git app Jan 23, 2011
WEPopoverViewController.xib Fixed issue #1: bug with presenting popover from scrollviews Jan 4, 2011
WEPopover_Prefix.pch Fixed issue #1: bug with presenting popover from scrollviews Jan 4, 2011
main.m Convert to ARC. Update target to iOS 5.0+ Aug 26, 2012
popoverArrowDown.png Updated the graphics to be less flat. Updated the code to allow dialo… Apr 29, 2011
popoverArrowDown@2x.png Updated the graphics to be less flat. Updated the code to allow dialo… Apr 29, 2011
popoverArrowLeft.png Updated the graphics to be less flat. Updated the code to allow dialo… Apr 29, 2011
popoverArrowLeft@2x.png Updated the graphics to be less flat. Updated the code to allow dialo… Apr 29, 2011
popoverArrowRight.png Updated the graphics to be less flat. Updated the code to allow dialo… Apr 29, 2011
popoverArrowRight@2x.png Updated the graphics to be less flat. Updated the code to allow dialo… Apr 29, 2011
popoverArrowUp.png Updated the graphics to be less flat. Updated the code to allow dialo… Apr 29, 2011
popoverArrowUp@2x.png Updated the graphics to be less flat. Updated the code to allow dialo… Apr 29, 2011
popoverBg.png Updated the small shadow. Apr 29, 2011
popoverBg@2x.png Updated the graphics to be less flat. Updated the code to allow dialo… Apr 29, 2011

README.md

WEPopover

The WEPopover is designed to mimic the behavior and appearance of the UIPopover only available on iPad. It is designed to work on iPad, iPhone, and includes support for Retina displays.

Features:

  1. iOS 5.0+
  2. Retina support
  3. ARC

Installation

Add the code and image files to your project.

Example Usage

// Header .h
#include "WEPopoverController.h"
...
WEPopoverController *navPopover;

// Implementation .m

// Create a label with custom text 
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 100, 40)];
[label setText:@"Bookmark it!"];
[label setBackgroundColor:[UIColor clearColor]];
[label setTextColor:[UIColor whiteColor]];
[label setTextAlignment:UITextAlignmentCenter];

UIFont *font = [UIFont boldSystemFontOfSize:20];
[label setFont:font];
CGSize size = [label.text sizeWithFont:font];
CGRect frame = CGRectMake(0, 0, size.width + 10, size.height + 10); // add a bit of a border around the text
label.frame = frame;

//  place inside a temporary view controller and add to popover
UIViewController *viewCon = [[UIViewController alloc] init];
viewCon.view = label;
viewCon.contentSizeForViewInPopover = frame.size;       // Set the content size

navPopover = [[WEPopoverController alloc] initWithContentViewController:viewCon];
[navPopover presentPopoverFromRect:CGRectMake(0, 0, 50, 57)
                                   inView:self.view
                 permittedArrowDirections:UIPopoverArrowDirectionUp | UIPopoverArrowDirectionDown
                                 animated:YES];

iOS

iPhone iPhone 4

Something went wrong with that request. Please try again.