Skip to content

Commit 71c18b3

Browse files
Demo updated
1 parent 4c5e66c commit 71c18b3

3 files changed

Lines changed: 20 additions & 8 deletions

File tree

WYPopoverController/WYPopoverController.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2383,7 +2383,7 @@ - (void)didChangeDeviceOrientation:(NSNotification*)notification
23832383

23842384
- (void)keyboardWillShow:(NSNotification *)notification
23852385
{
2386-
NSDictionary* info = [notification userInfo];
2386+
NSDictionary *info = [notification userInfo];
23872387
keyboardRect = [[info objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue];
23882388
[self positionPopover];
23892389
[containerView setNeedsDisplay];

demos/Demo/WYPopoverDemo/WYAllDirectionsViewController.m

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ @interface WYAllDirectionsViewController () <WYPopoverControllerDelegate>
1717
}
1818

1919
- (IBAction)open:(id)sender;
20+
- (void)close:(id)sender;
2021

2122
@end
2223

@@ -43,8 +44,8 @@ - (void)viewDidLoad
4344
self.edgesForExtendedLayout = UIRectEdgeNone;
4445
}
4546

46-
UIImage* normal = [[UIImage imageNamed:@"button-normal"] stretchableImageWithLeftCapWidth:16 topCapHeight:0];
47-
UIImage* highlighted = [[UIImage imageNamed:@"button-highlighted"] stretchableImageWithLeftCapWidth:16 topCapHeight:0];
47+
UIImage *normal = [[UIImage imageNamed:@"button-normal"] stretchableImageWithLeftCapWidth:16 topCapHeight:0];
48+
UIImage *highlighted = [[UIImage imageNamed:@"button-highlighted"] stretchableImageWithLeftCapWidth:16 topCapHeight:0];
4849

4950
[topLeftButton setBackgroundImage:normal forState:UIControlStateNormal]; [topLeftButton setBackgroundImage:highlighted forState:UIControlStateHighlighted];
5051
[topButton setBackgroundImage:normal forState:UIControlStateNormal]; [topButton setBackgroundImage:highlighted forState:UIControlStateHighlighted];
@@ -59,7 +60,14 @@ - (void)viewDidLoad
5960

6061
- (IBAction)open:(id)sender
6162
{
62-
[self showmodal:sender];
63+
[self showpopover:sender];
64+
}
65+
66+
- (void)close:(id)sender
67+
{
68+
[settingsPopoverController dismissPopoverAnimated:YES];
69+
settingsPopoverController.delegate = nil;
70+
settingsPopoverController = nil;
6371
}
6472

6573
- (IBAction)showmodal:(id)sender
@@ -75,7 +83,7 @@ - (IBAction)showpopover:(id)sender
7583
{
7684
if (settingsPopoverController == nil)
7785
{
78-
UIView* btn = (UIView*)sender;
86+
UIView *btn = (UIView*)sender;
7987

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

@@ -87,7 +95,7 @@ - (IBAction)showpopover:(id)sender
8795
}
8896

8997
settingsViewController.title = @"Settings";
90-
[settingsViewController.navigationItem setRightBarButtonItem:[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(done:)]];
98+
[settingsViewController.navigationItem setRightBarButtonItem:[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(close:)]];
9199

92100
settingsViewController.modalInPopover = NO;
93101

@@ -105,6 +113,10 @@ - (IBAction)showpopover:(id)sender
105113
animated:YES
106114
options:WYPopoverAnimationOptionFadeWithScale];
107115
}
116+
else
117+
{
118+
[self close:nil];
119+
}
108120
}
109121

110122
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender

demos/Demo/WYPopoverDemo/WYStoryboard.storyboard

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
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="12F37" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" initialViewController="KSs-by-RAI">
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="4514" systemVersion="13A603" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" initialViewController="KSs-by-RAI">
33
<dependencies>
44
<deployment defaultVersion="1552" identifier="iOS"/>
5-
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3746"/>
5+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3747"/>
66
</dependencies>
77
<scenes>
88
<!--All Directions View Controller - POPOVER-->

0 commit comments

Comments
 (0)