Skip to content

Commit

Permalink
Update README and Demo
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicolas CHENG committed Feb 20, 2014
1 parent f5bd924 commit 6c41a85
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 16 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,13 @@ WYPopoverController uses ARC.

#### Cocoapods

Add this line `pod 'WYPopoverController', '~> 0.1.9'` to your PodFile.
Add this line `pod 'WYPopoverController', '~> 0.2.0'` to your PodFile.

Your PodFile should look like :

```Ruby
platform :ios, '6.0'
pod 'WYPopoverController', '~> 0.1.9'
pod 'WYPopoverController', '~> 0.2.0'
```

To use the `master` branch of the repo :
Expand Down
2 changes: 1 addition & 1 deletion WYPopoverController/WYPopoverController.m
Original file line number Diff line number Diff line change
Expand Up @@ -1559,7 +1559,7 @@ - (void)setPopoverContentSize:(CGSize)size
#pragma clang diagnostic pop
}

[self positionPopover:NO];
[self positionPopover:YES];
}

- (void)presentPopoverFromRect:(CGRect)aRect
Expand Down
4 changes: 2 additions & 2 deletions demos/Demo/WYPopoverDemo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "WYPopoverDemo/WYPopoverDemo-Prefix.pch";
INFOPLIST_FILE = "WYPopoverDemo/WYPopoverDemo-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 6.1;
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
PRODUCT_NAME = "$(TARGET_NAME)";
TARGETED_DEVICE_FAMILY = "1,2";
WRAPPER_EXTENSION = app;
Expand All @@ -346,7 +346,7 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "WYPopoverDemo/WYPopoverDemo-Prefix.pch";
INFOPLIST_FILE = "WYPopoverDemo/WYPopoverDemo-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 6.1;
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
PRODUCT_NAME = "$(TARGET_NAME)";
TARGETED_DEVICE_FAMILY = "1,2";
WRAPPER_EXTENSION = app;
Expand Down
19 changes: 15 additions & 4 deletions demos/Demo/WYPopoverDemo/WYAllDirectionsViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ - (void)close:(id)sender
}];
}

- (void)sizeUp:(id)sender
{
[settingsPopoverController setPopoverContentSize:CGSizeMake(320, 480)];
}

- (IBAction)showmodal:(id)sender
{
WYModalViewController *modalViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"WYModalViewController"];
Expand All @@ -83,23 +88,29 @@ - (IBAction)showpopover:(id)sender
{
if (settingsPopoverController == nil)
{
UIView *btn = (UIView*)sender;
UIView *btn = (UIView *)sender;

WYSettingsViewController *settingsViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"WYSettingsViewController"];

if ([settingsViewController respondsToSelector:@selector(setPreferredContentSize:)]) {
settingsViewController.preferredContentSize = CGSizeMake(320, 320); // iOS 7
settingsViewController.preferredContentSize = CGSizeMake(320, 280); // iOS 7
}
else {
settingsViewController.contentSizeForViewInPopover = CGSizeMake(320, 320); // iOS < 7
#pragma clang diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated"
settingsViewController.contentSizeForViewInPopover = CGSizeMake(320, 280); // iOS < 7
#pragma clang diagnostic pop
}

settingsViewController.title = @"Settings";

[settingsViewController.navigationItem setLeftBarButtonItem:[[UIBarButtonItem alloc] initWithTitle:@"Size Up" style:UIBarButtonItemStylePlain target:self action:@selector(sizeUp:)]];

[settingsViewController.navigationItem setRightBarButtonItem:[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(close:)]];

settingsViewController.modalInPopover = NO;

UINavigationController* contentViewController = [[UINavigationController alloc] initWithRootViewController:settingsViewController];
UINavigationController *contentViewController = [[UINavigationController alloc] initWithRootViewController:settingsViewController];

settingsPopoverController = [[WYPopoverController alloc] initWithContentViewController:contentViewController];
settingsPopoverController.delegate = self;
Expand Down
27 changes: 22 additions & 5 deletions demos/Demo/WYPopoverDemo/WYAppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,29 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
[popoverAppearance setViewContentInsets:UIEdgeInsetsMake(3, 0, 0, 0)];
*/

UINavigationBar *navBarAppearance = [UINavigationBar appearanceWhenContainedIn:[UINavigationController class], [WYPopoverBackgroundView class], nil];
[navBarAppearance setTitleTextAttributes:@{
UITextAttributeTextColor : [UIColor whiteColor],
UITextAttributeTextShadowColor: [UIColor clearColor],
UITextAttributeTextShadowOffset: [NSValue valueWithUIOffset:UIOffsetMake(0, 0)]
}];

#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 70000

NSShadow *shadow = [[NSShadow alloc] init];
[shadow setShadowColor:[UIColor clearColor]];
[shadow setShadowOffset:CGSizeZero];

[navBarAppearance setTitleTextAttributes:
@{
NSForegroundColorAttributeName : [UIColor whiteColor],
NSShadowAttributeName: shadow
}];

#else
[navBarAppearance setTitleTextAttributes:
@{
UITextAttributeTextColor : [UIColor whiteColor],
UITextAttributeTextShadowColor: [UIColor clearColor],
UITextAttributeTextShadowOffset: [NSValue valueWithUIOffset:UIOffsetMake(0, 0)]
}];
#endif

//Appearance 2 (orange popover)
//
Expand Down
3 changes: 3 additions & 0 deletions demos/Demo/WYPopoverDemo/WYModalViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ - (IBAction)showpopover:(id)sender
settingsViewController.preferredContentSize = CGSizeMake(280, 200); // iOS 7
}
else {
#pragma clang diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated"
settingsViewController.contentSizeForViewInPopover = CGSizeMake(280, 200); // iOS < 7
#pragma clang diagnostic pop
}

settingsViewController.title = @"Settings";
Expand Down
4 changes: 2 additions & 2 deletions demos/Demo/WYPopoverDemo/WYStoryboard.storyboard
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="4514" systemVersion="13B42" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" initialViewController="KSs-by-RAI">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="4514" systemVersion="12F45" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" initialViewController="KSs-by-RAI">
<dependencies>
<deployment defaultVersion="1552" identifier="iOS"/>
<deployment defaultVersion="1792" identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3747"/>
</dependencies>
<scenes>
Expand Down

0 comments on commit 6c41a85

Please sign in to comment.