Skip to content

Commit

Permalink
Added Paul Solt's images
Browse files Browse the repository at this point in the history
  • Loading branch information
werner77 committed Jun 13, 2011
1 parent 9435d1d commit b666e8f
Show file tree
Hide file tree
Showing 18 changed files with 125 additions and 25 deletions.
11 changes: 6 additions & 5 deletions Classes/Popover/WEPopoverController.m
Original file line number Diff line number Diff line change
Expand Up @@ -273,11 +273,12 @@ - (CGRect)displayAreaForView:(UIView *)theView {
return displayArea;
}

//Enable to use the simple popover style
- (WEPopoverContainerViewProperties *)defaultContainerViewProperties {
WEPopoverContainerViewProperties *ret = [[WEPopoverContainerViewProperties new] autorelease];

CGSize imageSize = CGSizeMake(30.0f, 30.0f);
NSString *bgImageName = @"popoverBg.png";
NSString *bgImageName = @"popoverBgSimple.png";
CGFloat bgMargin = 6.0;
CGFloat contentMargin = 2.0;

Expand All @@ -294,10 +295,10 @@ - (WEPopoverContainerViewProperties *)defaultContainerViewProperties {
ret.bottomContentMargin = contentMargin;
ret.arrowMargin = 1.0;

ret.upArrowImageName = @"popoverArrowUp.png";
ret.downArrowImageName = @"popoverArrowDown.png";
ret.leftArrowImageName = @"popoverArrowLeft.png";
ret.rightArrowImageName = @"popoverArrowRight.png";
ret.upArrowImageName = @"popoverArrowUpSimple.png";
ret.downArrowImageName = @"popoverArrowDownSimple.png";
ret.leftArrowImageName = @"popoverArrowLeftSimple.png";
ret.rightArrowImageName = @"popoverArrowRightSimple.png";
return ret;
}

Expand Down
43 changes: 43 additions & 0 deletions Classes/WEPopoverTableViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ - (id)initWithStyle:(UITableViewStyle)style {
- (void)viewDidLoad {
[super viewDidLoad];

//Try setting this to UIPopoverController to use the iPad popover. The API is exactly the same!
popoverClass = [WEPopoverController class];

// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
Expand Down Expand Up @@ -150,6 +151,43 @@ - (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)
}
*/

/**
Thanks to Paul Solt for supplying these background images and container view properties
*/
- (WEPopoverContainerViewProperties *)improvedContainerViewProperties {

WEPopoverContainerViewProperties *props = [[WEPopoverContainerViewProperties alloc] autorelease];
NSString *bgImageName = nil;
CGFloat bgMargin = 0.0;
CGFloat bgCapSize = 0.0;
CGFloat contentMargin = 4.0;

bgImageName = @"popoverBg.png";

// These constants are determined by the popoverBg.png image file and are image dependent
bgMargin = 13; // margin width of 13 pixels on all sides popoverBg.png (62 pixels wide - 36 pixel background) / 2 == 26 / 2 == 13
bgCapSize = 31; // ImageSize/2 == 62 / 2 == 31 pixels

props.leftBgMargin = bgMargin;
props.rightBgMargin = bgMargin;
props.topBgMargin = bgMargin;
props.bottomBgMargin = bgMargin;
props.leftBgCapSize = bgCapSize;
props.topBgCapSize = bgCapSize;
props.bgImageName = bgImageName;
props.leftContentMargin = contentMargin;
props.rightContentMargin = contentMargin - 1; // Need to shift one pixel for border to look correct
props.topContentMargin = contentMargin;
props.bottomContentMargin = contentMargin;

props.arrowMargin = 4.0;

props.upArrowImageName = @"popoverArrowUp.png";
props.downArrowImageName = @"popoverArrowDown.png";
props.leftArrowImageName = @"popoverArrowLeft.png";
props.rightArrowImageName = @"popoverArrowRight.png";
return props;
}

#pragma mark -
#pragma mark Table view delegate
Expand All @@ -173,6 +211,11 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
CGRect rect = frame;

self.popoverController = [[[popoverClass alloc] initWithContentViewController:contentViewController] autorelease];

if ([self.popoverController respondsToSelector:@selector(setContainerViewProperties:)]) {
[self.popoverController setContainerViewProperties:[self improvedContainerViewProperties]];
}

self.popoverController.delegate = self;

//Uncomment the line below to allow the table view to handle events while the popover is displayed.
Expand Down
96 changes: 76 additions & 20 deletions WEPopover.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,24 @@
2899E5220DE3E06400AC0155 /* WEPopoverViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 2899E5210DE3E06400AC0155 /* WEPopoverViewController.xib */; };
28AD733F0D9D9553002E5188 /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 28AD733E0D9D9553002E5188 /* MainWindow.xib */; };
28D7ACF80DDB3853001CB0EB /* WEPopoverViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 28D7ACF70DDB3853001CB0EB /* WEPopoverViewController.m */; };
7407D7C813A67A930074B83C /* popoverBgSimple.png in Resources */ = {isa = PBXBuildFile; fileRef = 7407D7C313A67A930074B83C /* popoverBgSimple.png */; };
7407D7C913A67A930074B83C /* popoverArrowUpSimple.png in Resources */ = {isa = PBXBuildFile; fileRef = 7407D7C413A67A930074B83C /* popoverArrowUpSimple.png */; };
7407D7CA13A67A930074B83C /* popoverArrowRightSimple.png in Resources */ = {isa = PBXBuildFile; fileRef = 7407D7C513A67A930074B83C /* popoverArrowRightSimple.png */; };
7407D7CB13A67A930074B83C /* popoverArrowLeftSimple.png in Resources */ = {isa = PBXBuildFile; fileRef = 7407D7C613A67A930074B83C /* popoverArrowLeftSimple.png */; };
7407D7CC13A67A930074B83C /* popoverArrowDownSimple.png in Resources */ = {isa = PBXBuildFile; fileRef = 7407D7C713A67A930074B83C /* popoverArrowDownSimple.png */; };
7407D7D713A67ABD0074B83C /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = 7407D7CD13A67ABD0074B83C /* [email protected] */; };
7407D7D813A67ABD0074B83C /* popoverBg.png in Resources */ = {isa = PBXBuildFile; fileRef = 7407D7CE13A67ABD0074B83C /* popoverBg.png */; };
7407D7D913A67ABD0074B83C /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = 7407D7CF13A67ABD0074B83C /* [email protected] */; };
7407D7DA13A67ABD0074B83C /* popoverArrowUp.png in Resources */ = {isa = PBXBuildFile; fileRef = 7407D7D013A67ABD0074B83C /* popoverArrowUp.png */; };
7407D7DB13A67ABD0074B83C /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = 7407D7D113A67ABD0074B83C /* [email protected] */; };
7407D7DC13A67ABD0074B83C /* popoverArrowRight.png in Resources */ = {isa = PBXBuildFile; fileRef = 7407D7D213A67ABD0074B83C /* popoverArrowRight.png */; };
7407D7DD13A67ABD0074B83C /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = 7407D7D313A67ABD0074B83C /* [email protected] */; };
7407D7DE13A67ABD0074B83C /* popoverArrowLeft.png in Resources */ = {isa = PBXBuildFile; fileRef = 7407D7D413A67ABD0074B83C /* popoverArrowLeft.png */; };
7407D7DF13A67ABD0074B83C /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = 7407D7D513A67ABD0074B83C /* [email protected] */; };
7407D7E013A67ABD0074B83C /* popoverArrowDown.png in Resources */ = {isa = PBXBuildFile; fileRef = 7407D7D613A67ABD0074B83C /* popoverArrowDown.png */; };
7463500113729C6F000EF936 /* WETouchableView.m in Sources */ = {isa = PBXBuildFile; fileRef = 7463500013729C6F000EF936 /* WETouchableView.m */; };
746B0A1D137454A000C5A8B5 /* UIBarButtonItem+WEPopover.m in Sources */ = {isa = PBXBuildFile; fileRef = 746B0A1C137454A000C5A8B5 /* UIBarButtonItem+WEPopover.m */; };
7496C86112D363AC00F93229 /* WEPopoverTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7496C86012D363AC00F93229 /* WEPopoverTableViewController.m */; };
749FAE791286125600AB97F9 /* popoverArrowDown.png in Resources */ = {isa = PBXBuildFile; fileRef = 749FAE731286125600AB97F9 /* popoverArrowDown.png */; };
749FAE7A1286125600AB97F9 /* popoverArrowLeft.png in Resources */ = {isa = PBXBuildFile; fileRef = 749FAE741286125600AB97F9 /* popoverArrowLeft.png */; };
749FAE7B1286125600AB97F9 /* popoverArrowRight.png in Resources */ = {isa = PBXBuildFile; fileRef = 749FAE751286125600AB97F9 /* popoverArrowRight.png */; };
749FAE7C1286125600AB97F9 /* popoverArrowUp.png in Resources */ = {isa = PBXBuildFile; fileRef = 749FAE761286125600AB97F9 /* popoverArrowUp.png */; };
749FAE7D1286125600AB97F9 /* popoverBg.png in Resources */ = {isa = PBXBuildFile; fileRef = 749FAE771286125600AB97F9 /* popoverBg.png */; };
749FAE861286130000AB97F9 /* WEPopoverContainerView.m in Sources */ = {isa = PBXBuildFile; fileRef = 749FAE801286130000AB97F9 /* WEPopoverContainerView.m */; };
749FAE871286130000AB97F9 /* WEPopoverContentViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 749FAE821286130000AB97F9 /* WEPopoverContentViewController.m */; };
749FAE881286130000AB97F9 /* WEPopoverController.m in Sources */ = {isa = PBXBuildFile; fileRef = 749FAE841286130000AB97F9 /* WEPopoverController.m */; };
Expand All @@ -41,17 +51,27 @@
28D7ACF70DDB3853001CB0EB /* WEPopoverViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WEPopoverViewController.m; sourceTree = "<group>"; };
29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
32CA4F630368D1EE00C91783 /* WEPopover_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WEPopover_Prefix.pch; sourceTree = "<group>"; };
7407D7C313A67A930074B83C /* popoverBgSimple.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = popoverBgSimple.png; sourceTree = "<group>"; };
7407D7C413A67A930074B83C /* popoverArrowUpSimple.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = popoverArrowUpSimple.png; sourceTree = "<group>"; };
7407D7C513A67A930074B83C /* popoverArrowRightSimple.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = popoverArrowRightSimple.png; sourceTree = "<group>"; };
7407D7C613A67A930074B83C /* popoverArrowLeftSimple.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = popoverArrowLeftSimple.png; sourceTree = "<group>"; };
7407D7C713A67A930074B83C /* popoverArrowDownSimple.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = popoverArrowDownSimple.png; sourceTree = "<group>"; };
7407D7CD13A67ABD0074B83C /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
7407D7CE13A67ABD0074B83C /* popoverBg.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = popoverBg.png; sourceTree = "<group>"; };
7407D7CF13A67ABD0074B83C /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
7407D7D013A67ABD0074B83C /* popoverArrowUp.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = popoverArrowUp.png; sourceTree = "<group>"; };
7407D7D113A67ABD0074B83C /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
7407D7D213A67ABD0074B83C /* popoverArrowRight.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = popoverArrowRight.png; sourceTree = "<group>"; };
7407D7D313A67ABD0074B83C /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
7407D7D413A67ABD0074B83C /* popoverArrowLeft.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = popoverArrowLeft.png; sourceTree = "<group>"; };
7407D7D513A67ABD0074B83C /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
7407D7D613A67ABD0074B83C /* popoverArrowDown.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = popoverArrowDown.png; sourceTree = "<group>"; };
74634FFF13729C6F000EF936 /* WETouchableView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WETouchableView.h; sourceTree = "<group>"; };
7463500013729C6F000EF936 /* WETouchableView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WETouchableView.m; sourceTree = "<group>"; };
746B0A1B137454A000C5A8B5 /* UIBarButtonItem+WEPopover.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIBarButtonItem+WEPopover.h"; sourceTree = "<group>"; };
746B0A1C137454A000C5A8B5 /* UIBarButtonItem+WEPopover.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIBarButtonItem+WEPopover.m"; sourceTree = "<group>"; };
7496C85F12D363AC00F93229 /* WEPopoverTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WEPopoverTableViewController.h; sourceTree = "<group>"; };
7496C86012D363AC00F93229 /* WEPopoverTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WEPopoverTableViewController.m; sourceTree = "<group>"; };
749FAE731286125600AB97F9 /* popoverArrowDown.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = popoverArrowDown.png; sourceTree = "<group>"; };
749FAE741286125600AB97F9 /* popoverArrowLeft.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = popoverArrowLeft.png; sourceTree = "<group>"; };
749FAE751286125600AB97F9 /* popoverArrowRight.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = popoverArrowRight.png; sourceTree = "<group>"; };
749FAE761286125600AB97F9 /* popoverArrowUp.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = popoverArrowUp.png; sourceTree = "<group>"; };
749FAE771286125600AB97F9 /* popoverBg.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = popoverBg.png; sourceTree = "<group>"; };
749FAE7F1286130000AB97F9 /* WEPopoverContainerView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WEPopoverContainerView.h; sourceTree = "<group>"; };
749FAE801286130000AB97F9 /* WEPopoverContainerView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WEPopoverContainerView.m; sourceTree = "<group>"; };
749FAE811286130000AB97F9 /* WEPopoverContentViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WEPopoverContentViewController.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -142,6 +162,35 @@
name = Frameworks;
sourceTree = "<group>";
};
7407D7C113A67A720074B83C /* Simple */ = {
isa = PBXGroup;
children = (
7407D7C313A67A930074B83C /* popoverBgSimple.png */,
7407D7C413A67A930074B83C /* popoverArrowUpSimple.png */,
7407D7C513A67A930074B83C /* popoverArrowRightSimple.png */,
7407D7C613A67A930074B83C /* popoverArrowLeftSimple.png */,
7407D7C713A67A930074B83C /* popoverArrowDownSimple.png */,
);
name = Simple;
sourceTree = "<group>";
};
7407D7C213A67A7A0074B83C /* Improved */ = {
isa = PBXGroup;
children = (
7407D7CD13A67ABD0074B83C /* [email protected] */,
7407D7CE13A67ABD0074B83C /* popoverBg.png */,
7407D7CF13A67ABD0074B83C /* [email protected] */,
7407D7D013A67ABD0074B83C /* popoverArrowUp.png */,
7407D7D113A67ABD0074B83C /* [email protected] */,
7407D7D213A67ABD0074B83C /* popoverArrowRight.png */,
7407D7D313A67ABD0074B83C /* [email protected] */,
7407D7D413A67ABD0074B83C /* popoverArrowLeft.png */,
7407D7D513A67ABD0074B83C /* [email protected] */,
7407D7D613A67ABD0074B83C /* popoverArrowDown.png */,
);
name = Improved;
sourceTree = "<group>";
};
749FAE6F1286123500AB97F9 /* Popover */ = {
isa = PBXGroup;
children = (
Expand All @@ -161,11 +210,8 @@
749FAE721286123F00AB97F9 /* Popover */ = {
isa = PBXGroup;
children = (
749FAE731286125600AB97F9 /* popoverArrowDown.png */,
749FAE741286125600AB97F9 /* popoverArrowLeft.png */,
749FAE751286125600AB97F9 /* popoverArrowRight.png */,
749FAE761286125600AB97F9 /* popoverArrowUp.png */,
749FAE771286125600AB97F9 /* popoverBg.png */,
7407D7C213A67A7A0074B83C /* Improved */,
7407D7C113A67A720074B83C /* Simple */,
);
name = Popover;
sourceTree = "<group>";
Expand Down Expand Up @@ -224,11 +270,21 @@
files = (
28AD733F0D9D9553002E5188 /* MainWindow.xib in Resources */,
2899E5220DE3E06400AC0155 /* WEPopoverViewController.xib in Resources */,
749FAE791286125600AB97F9 /* popoverArrowDown.png in Resources */,
749FAE7A1286125600AB97F9 /* popoverArrowLeft.png in Resources */,
749FAE7B1286125600AB97F9 /* popoverArrowRight.png in Resources */,
749FAE7C1286125600AB97F9 /* popoverArrowUp.png in Resources */,
749FAE7D1286125600AB97F9 /* popoverBg.png in Resources */,
7407D7C813A67A930074B83C /* popoverBgSimple.png in Resources */,
7407D7C913A67A930074B83C /* popoverArrowUpSimple.png in Resources */,
7407D7CA13A67A930074B83C /* popoverArrowRightSimple.png in Resources */,
7407D7CB13A67A930074B83C /* popoverArrowLeftSimple.png in Resources */,
7407D7CC13A67A930074B83C /* popoverArrowDownSimple.png in Resources */,
7407D7D713A67ABD0074B83C /* [email protected] in Resources */,
7407D7D813A67ABD0074B83C /* popoverBg.png in Resources */,
7407D7D913A67ABD0074B83C /* [email protected] in Resources */,
7407D7DA13A67ABD0074B83C /* popoverArrowUp.png in Resources */,
7407D7DB13A67ABD0074B83C /* [email protected] in Resources */,
7407D7DC13A67ABD0074B83C /* popoverArrowRight.png in Resources */,
7407D7DD13A67ABD0074B83C /* [email protected] in Resources */,
7407D7DE13A67ABD0074B83C /* popoverArrowLeft.png in Resources */,
7407D7DF13A67ABD0074B83C /* [email protected] in Resources */,
7407D7E013A67ABD0074B83C /* popoverArrowDown.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
Binary file modified popoverArrowDown.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added [email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added popoverArrowDownSimple.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified popoverArrowLeft.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added [email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added popoverArrowLeftSimple.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified popoverArrowRight.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added [email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added popoverArrowRightSimple.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified popoverArrowUp.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added [email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added popoverArrowUpSimple.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified popoverBg.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added [email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added popoverBgSimple.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit b666e8f

Please sign in to comment.