Skip to content

Commit 6c41a85

Browse files
author
Nicolas CHENG
committed
Update README and Demo
1 parent f5bd924 commit 6c41a85

File tree

7 files changed

+47
-16
lines changed

7 files changed

+47
-16
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,13 +149,13 @@ WYPopoverController uses ARC.
149149

150150
#### Cocoapods
151151

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

154154
Your PodFile should look like :
155155

156156
```Ruby
157157
platform :ios, '6.0'
158-
pod 'WYPopoverController', '~> 0.1.9'
158+
pod 'WYPopoverController', '~> 0.2.0'
159159
```
160160

161161
To use the `master` branch of the repo :

WYPopoverController/WYPopoverController.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1559,7 +1559,7 @@ - (void)setPopoverContentSize:(CGSize)size
15591559
#pragma clang diagnostic pop
15601560
}
15611561

1562-
[self positionPopover:NO];
1562+
[self positionPopover:YES];
15631563
}
15641564

15651565
- (void)presentPopoverFromRect:(CGRect)aRect

demos/Demo/WYPopoverDemo.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@
333333
GCC_PRECOMPILE_PREFIX_HEADER = YES;
334334
GCC_PREFIX_HEADER = "WYPopoverDemo/WYPopoverDemo-Prefix.pch";
335335
INFOPLIST_FILE = "WYPopoverDemo/WYPopoverDemo-Info.plist";
336-
IPHONEOS_DEPLOYMENT_TARGET = 6.1;
336+
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
337337
PRODUCT_NAME = "$(TARGET_NAME)";
338338
TARGETED_DEVICE_FAMILY = "1,2";
339339
WRAPPER_EXTENSION = app;
@@ -346,7 +346,7 @@
346346
GCC_PRECOMPILE_PREFIX_HEADER = YES;
347347
GCC_PREFIX_HEADER = "WYPopoverDemo/WYPopoverDemo-Prefix.pch";
348348
INFOPLIST_FILE = "WYPopoverDemo/WYPopoverDemo-Info.plist";
349-
IPHONEOS_DEPLOYMENT_TARGET = 6.1;
349+
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
350350
PRODUCT_NAME = "$(TARGET_NAME)";
351351
TARGETED_DEVICE_FAMILY = "1,2";
352352
WRAPPER_EXTENSION = app;

demos/Demo/WYPopoverDemo/WYAllDirectionsViewController.m

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,11 @@ - (void)close:(id)sender
7070
}];
7171
}
7272

73+
- (void)sizeUp:(id)sender
74+
{
75+
[settingsPopoverController setPopoverContentSize:CGSizeMake(320, 480)];
76+
}
77+
7378
- (IBAction)showmodal:(id)sender
7479
{
7580
WYModalViewController *modalViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"WYModalViewController"];
@@ -83,23 +88,29 @@ - (IBAction)showpopover:(id)sender
8388
{
8489
if (settingsPopoverController == nil)
8590
{
86-
UIView *btn = (UIView*)sender;
91+
UIView *btn = (UIView *)sender;
8792

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

9095
if ([settingsViewController respondsToSelector:@selector(setPreferredContentSize:)]) {
91-
settingsViewController.preferredContentSize = CGSizeMake(320, 320); // iOS 7
96+
settingsViewController.preferredContentSize = CGSizeMake(320, 280); // iOS 7
9297
}
9398
else {
94-
settingsViewController.contentSizeForViewInPopover = CGSizeMake(320, 320); // iOS < 7
99+
#pragma clang diagnostic push
100+
#pragma GCC diagnostic ignored "-Wdeprecated"
101+
settingsViewController.contentSizeForViewInPopover = CGSizeMake(320, 280); // iOS < 7
102+
#pragma clang diagnostic pop
95103
}
96104

97105
settingsViewController.title = @"Settings";
106+
107+
[settingsViewController.navigationItem setLeftBarButtonItem:[[UIBarButtonItem alloc] initWithTitle:@"Size Up" style:UIBarButtonItemStylePlain target:self action:@selector(sizeUp:)]];
108+
98109
[settingsViewController.navigationItem setRightBarButtonItem:[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(close:)]];
99110

100111
settingsViewController.modalInPopover = NO;
101112

102-
UINavigationController* contentViewController = [[UINavigationController alloc] initWithRootViewController:settingsViewController];
113+
UINavigationController *contentViewController = [[UINavigationController alloc] initWithRootViewController:settingsViewController];
103114

104115
settingsPopoverController = [[WYPopoverController alloc] initWithContentViewController:contentViewController];
105116
settingsPopoverController.delegate = self;

demos/Demo/WYPopoverDemo/WYAppDelegate.m

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,29 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
4848
4949
[popoverAppearance setViewContentInsets:UIEdgeInsetsMake(3, 0, 0, 0)];
5050
*/
51+
5152
UINavigationBar *navBarAppearance = [UINavigationBar appearanceWhenContainedIn:[UINavigationController class], [WYPopoverBackgroundView class], nil];
52-
[navBarAppearance setTitleTextAttributes:@{
53-
UITextAttributeTextColor : [UIColor whiteColor],
54-
UITextAttributeTextShadowColor: [UIColor clearColor],
55-
UITextAttributeTextShadowOffset: [NSValue valueWithUIOffset:UIOffsetMake(0, 0)]
56-
}];
53+
54+
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 70000
55+
56+
NSShadow *shadow = [[NSShadow alloc] init];
57+
[shadow setShadowColor:[UIColor clearColor]];
58+
[shadow setShadowOffset:CGSizeZero];
59+
60+
[navBarAppearance setTitleTextAttributes:
61+
@{
62+
NSForegroundColorAttributeName : [UIColor whiteColor],
63+
NSShadowAttributeName: shadow
64+
}];
65+
66+
#else
67+
[navBarAppearance setTitleTextAttributes:
68+
@{
69+
UITextAttributeTextColor : [UIColor whiteColor],
70+
UITextAttributeTextShadowColor: [UIColor clearColor],
71+
UITextAttributeTextShadowOffset: [NSValue valueWithUIOffset:UIOffsetMake(0, 0)]
72+
}];
73+
#endif
5774

5875
//Appearance 2 (orange popover)
5976
//

demos/Demo/WYPopoverDemo/WYModalViewController.m

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,10 @@ - (IBAction)showpopover:(id)sender
4848
settingsViewController.preferredContentSize = CGSizeMake(280, 200); // iOS 7
4949
}
5050
else {
51+
#pragma clang diagnostic push
52+
#pragma GCC diagnostic ignored "-Wdeprecated"
5153
settingsViewController.contentSizeForViewInPopover = CGSizeMake(280, 200); // iOS < 7
54+
#pragma clang diagnostic pop
5255
}
5356

5457
settingsViewController.title = @"Settings";

demos/Demo/WYPopoverDemo/WYStoryboard.storyboard

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2-
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="4514" systemVersion="13B42" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" initialViewController="KSs-by-RAI">
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="4514" systemVersion="12F45" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" initialViewController="KSs-by-RAI">
33
<dependencies>
4-
<deployment defaultVersion="1552" identifier="iOS"/>
4+
<deployment defaultVersion="1792" identifier="iOS"/>
55
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3747"/>
66
</dependencies>
77
<scenes>

0 commit comments

Comments
 (0)