Skip to content

Commit ab0e8bf

Browse files
author
Michael Frederick
committed
Reorganized the Demos
1 parent 0466c2a commit ab0e8bf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+2507
-0
lines changed

Demos/MFSideMenuDemoBasic/MFSideMenuDemoBasic.xcodeproj/project.pbxproj

+367
Large diffs are not rendered by default.

Demos/MFSideMenuDemoBasic/MFSideMenuDemoBasic.xcodeproj/project.xcworkspace/contents.xcworkspacedata

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//
2+
// DemoViewController.h
3+
// MFSideMenuDemo
4+
//
5+
// Created by Michael Frederick on 3/19/12.
6+
//
7+
8+
#import <UIKit/UIKit.h>
9+
10+
@interface DemoViewController : UIViewController
11+
12+
- (IBAction)pushAnotherPressed:(id)sender;
13+
14+
@end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
//
2+
// DemoViewController.m
3+
// MFSideMenuDemo
4+
//
5+
// Created by Michael Frederick on 3/19/12.
6+
//
7+
8+
#import "DemoViewController.h"
9+
#import "MFSideMenu.h"
10+
11+
@interface DemoViewController ()
12+
13+
@end
14+
15+
@implementation DemoViewController
16+
17+
- (void) dealloc {
18+
self.navigationController.sideMenu.menuStateEventBlock = nil;
19+
}
20+
21+
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
22+
return YES;
23+
}
24+
25+
- (void)viewDidLoad {
26+
[super viewDidLoad];
27+
self.title = @"Demo!";
28+
29+
[self setupMenuBarButtonItems];
30+
31+
__weak DemoViewController *weakSelf = self;
32+
// if you want to listen for menu open/close events
33+
// this is useful, for example, if you want to change a UIBarButtonItem when the menu closes
34+
self.navigationController.sideMenu.menuStateEventBlock = ^(MFSideMenuStateEvent event) {
35+
switch (event) {
36+
case MFSideMenuStateEventMenuWillOpen:
37+
// the menu will open
38+
weakSelf.navigationItem.title = @"Menu Will Open!";
39+
break;
40+
case MFSideMenuStateEventMenuDidOpen: {
41+
// the menu finished opening
42+
weakSelf.navigationItem.title = @"Menu Opened!";
43+
// double delayInSeconds = 2.0;
44+
// dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC));
45+
// dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
46+
// self.navigationController.sideMenu.menuWidth = 100.0f;
47+
// });
48+
break;
49+
}
50+
case MFSideMenuStateEventMenuWillClose:
51+
// the menu will close
52+
weakSelf.navigationItem.title = @"Menu Will Close!";
53+
break;
54+
case MFSideMenuStateEventMenuDidClose:
55+
// the menu finished closing
56+
weakSelf.navigationItem.title = @"Menu Closed!";
57+
//self.navigationController.sideMenu.menuWidth = 280.0f;
58+
break;
59+
}
60+
NSLog(@"event occurred: %@", weakSelf.navigationItem.title);
61+
[weakSelf setupMenuBarButtonItems];
62+
};
63+
}
64+
65+
- (void)setupMenuBarButtonItems {
66+
switch (self.navigationController.sideMenu.menuState) {
67+
case MFSideMenuStateClosed:
68+
if([[self.navigationController.viewControllers objectAtIndex:0] isEqual:self]) {
69+
self.navigationItem.leftBarButtonItem = [self leftMenuBarButtonItem];
70+
} else {
71+
self.navigationItem.leftBarButtonItem = [self backBarButtonItem];
72+
}
73+
self.navigationItem.rightBarButtonItem = [self rightMenuBarButtonItem];
74+
break;
75+
case MFSideMenuStateLeftMenuOpen:
76+
self.navigationItem.leftBarButtonItem = [self leftMenuBarButtonItem];
77+
break;
78+
case MFSideMenuStateRightMenuOpen:
79+
self.navigationItem.rightBarButtonItem = [self rightMenuBarButtonItem];
80+
break;
81+
}
82+
}
83+
84+
- (UIBarButtonItem *)leftMenuBarButtonItem {
85+
return [[UIBarButtonItem alloc]
86+
initWithImage:[UIImage imageNamed:@"menu-icon.png"] style:UIBarButtonItemStyleBordered
87+
target:self.navigationController.sideMenu
88+
action:@selector(toggleLeftSideMenu)];
89+
}
90+
91+
- (UIBarButtonItem *)rightMenuBarButtonItem {
92+
return [[UIBarButtonItem alloc]
93+
initWithImage:[UIImage imageNamed:@"menu-icon.png"] style:UIBarButtonItemStyleBordered
94+
target:self.navigationController.sideMenu
95+
action:@selector(toggleRightSideMenu)];
96+
}
97+
98+
- (UIBarButtonItem *)backBarButtonItem {
99+
return [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"back-arrow"]
100+
style:UIBarButtonItemStyleBordered
101+
target:self
102+
action:@selector(backButtonPressed:)];
103+
}
104+
105+
- (void)backButtonPressed:(id)sender {
106+
[self.navigationController popViewControllerAnimated:YES];
107+
}
108+
109+
- (IBAction)pushAnotherPressed:(id)sender {
110+
DemoViewController *demoController = [[DemoViewController alloc]
111+
initWithNibName:@"DemoViewController"
112+
bundle:nil];
113+
114+
[self.navigationController pushViewController:demoController animated:YES];
115+
}
116+
117+
@end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,253 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="8.00">
3+
<data>
4+
<int key="IBDocument.SystemTarget">1552</int>
5+
<string key="IBDocument.SystemVersion">12C60</string>
6+
<string key="IBDocument.InterfaceBuilderVersion">3084</string>
7+
<string key="IBDocument.AppKitVersion">1187.34</string>
8+
<string key="IBDocument.HIToolboxVersion">625.00</string>
9+
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
10+
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
11+
<string key="NS.object.0">2083</string>
12+
</object>
13+
<array key="IBDocument.IntegratedClassDependencies">
14+
<string>IBProxyObject</string>
15+
<string>IBUIButton</string>
16+
<string>IBUITextView</string>
17+
<string>IBUIView</string>
18+
</array>
19+
<array key="IBDocument.PluginDependencies">
20+
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
21+
</array>
22+
<object class="NSMutableDictionary" key="IBDocument.Metadata">
23+
<string key="NS.key.0">PluginDependencyRecalculationVersion</string>
24+
<integer value="1" key="NS.object.0"/>
25+
</object>
26+
<array class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
27+
<object class="IBProxyObject" id="372490531">
28+
<string key="IBProxiedObjectIdentifier">IBFilesOwner</string>
29+
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
30+
</object>
31+
<object class="IBProxyObject" id="975951072">
32+
<string key="IBProxiedObjectIdentifier">IBFirstResponder</string>
33+
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
34+
</object>
35+
<object class="IBUIView" id="191373211">
36+
<reference key="NSNextResponder"/>
37+
<int key="NSvFlags">274</int>
38+
<array class="NSMutableArray" key="NSSubviews">
39+
<object class="IBUIButton" id="905262408">
40+
<reference key="NSNextResponder" ref="191373211"/>
41+
<int key="NSvFlags">290</int>
42+
<string key="NSFrame">{{20, 142}, {280, 37}}</string>
43+
<reference key="NSSuperview" ref="191373211"/>
44+
<reference key="NSWindow"/>
45+
<reference key="NSNextKeyView"/>
46+
<string key="NSReuseIdentifierKey">_NS:9</string>
47+
<bool key="IBUIOpaque">NO</bool>
48+
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
49+
<int key="IBUIContentHorizontalAlignment">0</int>
50+
<int key="IBUIContentVerticalAlignment">0</int>
51+
<int key="IBUIButtonType">1</int>
52+
<string key="IBUINormalTitle">Push Another Controller</string>
53+
<object class="NSColor" key="IBUIHighlightedTitleColor">
54+
<int key="NSColorSpace">3</int>
55+
<bytes key="NSWhite">MQA</bytes>
56+
</object>
57+
<object class="NSColor" key="IBUINormalTitleColor">
58+
<int key="NSColorSpace">1</int>
59+
<bytes key="NSRGB">MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA</bytes>
60+
</object>
61+
<object class="NSColor" key="IBUINormalTitleShadowColor">
62+
<int key="NSColorSpace">3</int>
63+
<bytes key="NSWhite">MC41AA</bytes>
64+
</object>
65+
<object class="IBUIFontDescription" key="IBUIFontDescription">
66+
<int key="type">2</int>
67+
<double key="pointSize">15</double>
68+
</object>
69+
<object class="NSFont" key="IBUIFont">
70+
<string key="NSName">Helvetica-Bold</string>
71+
<double key="NSSize">15</double>
72+
<int key="NSfFlags">16</int>
73+
</object>
74+
</object>
75+
<object class="IBUITextView" id="646849533">
76+
<reference key="NSNextResponder" ref="191373211"/>
77+
<int key="NSvFlags">290</int>
78+
<string key="NSFrame">{{20, 20}, {280, 102}}</string>
79+
<reference key="NSSuperview" ref="191373211"/>
80+
<reference key="NSWindow"/>
81+
<reference key="NSNextKeyView" ref="905262408"/>
82+
<string key="NSReuseIdentifierKey">_NS:9</string>
83+
<object class="NSColor" key="IBUIBackgroundColor">
84+
<int key="NSColorSpace">1</int>
85+
<bytes key="NSRGB">MSAxIDEAA</bytes>
86+
</object>
87+
<bool key="IBUIClipsSubviews">YES</bool>
88+
<bool key="IBUIMultipleTouchEnabled">YES</bool>
89+
<bool key="IBUIUserInteractionEnabled">NO</bool>
90+
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
91+
<bool key="IBUIEditable">NO</bool>
92+
<string key="IBUIText"/>
93+
<object class="IBUITextInputTraits" key="IBUITextInputTraits">
94+
<int key="IBUIAutocapitalizationType">2</int>
95+
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
96+
</object>
97+
<object class="IBUIFontDescription" key="IBUIFontDescription">
98+
<int key="type">1</int>
99+
<double key="pointSize">14</double>
100+
</object>
101+
<object class="NSFont" key="IBUIFont">
102+
<string key="NSName">Helvetica</string>
103+
<double key="NSSize">14</double>
104+
<int key="NSfFlags">16</int>
105+
</object>
106+
</object>
107+
</array>
108+
<string key="NSFrame">{{0, 64}, {320, 504}}</string>
109+
<reference key="NSSuperview"/>
110+
<reference key="NSWindow"/>
111+
<reference key="NSNextKeyView" ref="646849533"/>
112+
<object class="NSColor" key="IBUIBackgroundColor">
113+
<int key="NSColorSpace">3</int>
114+
<bytes key="NSWhite">MQA</bytes>
115+
<object class="NSColorSpace" key="NSCustomColorSpace">
116+
<int key="NSID">2</int>
117+
</object>
118+
</object>
119+
<object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/>
120+
<object class="IBUISimulatedNavigationBarMetrics" key="IBUISimulatedTopBarMetrics">
121+
<bool key="IBUIPrompted">NO</bool>
122+
</object>
123+
<object class="IBUIScreenMetrics" key="IBUISimulatedDestinationMetrics">
124+
<string key="IBUISimulatedSizeMetricsClass">IBUIScreenMetrics</string>
125+
<object class="NSMutableDictionary" key="IBUINormalizedOrientationToSizeMap">
126+
<bool key="EncodedWithXMLCoder">YES</bool>
127+
<array key="dict.sortedKeys">
128+
<integer value="1"/>
129+
<integer value="3"/>
130+
</array>
131+
<array key="dict.values">
132+
<string>{320, 568}</string>
133+
<string>{568, 320}</string>
134+
</array>
135+
</object>
136+
<string key="IBUITargetRuntime">IBCocoaTouchFramework</string>
137+
<string key="IBUIDisplayName">Retina 4 Full Screen</string>
138+
<int key="IBUIType">2</int>
139+
</object>
140+
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
141+
</object>
142+
</array>
143+
<object class="IBObjectContainer" key="IBDocument.Objects">
144+
<array class="NSMutableArray" key="connectionRecords">
145+
<object class="IBConnectionRecord">
146+
<object class="IBCocoaTouchOutletConnection" key="connection">
147+
<string key="label">view</string>
148+
<reference key="source" ref="372490531"/>
149+
<reference key="destination" ref="191373211"/>
150+
</object>
151+
<int key="connectionID">4</int>
152+
</object>
153+
<object class="IBConnectionRecord">
154+
<object class="IBCocoaTouchEventConnection" key="connection">
155+
<string key="label">pushAnotherPressed:</string>
156+
<reference key="source" ref="905262408"/>
157+
<reference key="destination" ref="372490531"/>
158+
<int key="IBEventType">7</int>
159+
</object>
160+
<int key="connectionID">6</int>
161+
</object>
162+
</array>
163+
<object class="IBMutableOrderedSet" key="objectRecords">
164+
<array key="orderedObjects">
165+
<object class="IBObjectRecord">
166+
<int key="objectID">0</int>
167+
<array key="object" id="0"/>
168+
<reference key="children" ref="1000"/>
169+
<nil key="parent"/>
170+
</object>
171+
<object class="IBObjectRecord">
172+
<int key="objectID">1</int>
173+
<reference key="object" ref="191373211"/>
174+
<array class="NSMutableArray" key="children">
175+
<reference ref="905262408"/>
176+
<reference ref="646849533"/>
177+
</array>
178+
<reference key="parent" ref="0"/>
179+
</object>
180+
<object class="IBObjectRecord">
181+
<int key="objectID">-1</int>
182+
<reference key="object" ref="372490531"/>
183+
<reference key="parent" ref="0"/>
184+
<string key="objectName">File's Owner</string>
185+
</object>
186+
<object class="IBObjectRecord">
187+
<int key="objectID">-2</int>
188+
<reference key="object" ref="975951072"/>
189+
<reference key="parent" ref="0"/>
190+
</object>
191+
<object class="IBObjectRecord">
192+
<int key="objectID">5</int>
193+
<reference key="object" ref="905262408"/>
194+
<array class="NSMutableArray" key="children"/>
195+
<reference key="parent" ref="191373211"/>
196+
</object>
197+
<object class="IBObjectRecord">
198+
<int key="objectID">7</int>
199+
<reference key="object" ref="646849533"/>
200+
<array class="NSMutableArray" key="children"/>
201+
<reference key="parent" ref="191373211"/>
202+
</object>
203+
</array>
204+
</object>
205+
<dictionary class="NSMutableDictionary" key="flattenedProperties">
206+
<string key="-1.CustomClassName">DemoViewController</string>
207+
<string key="-1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
208+
<string key="-2.CustomClassName">UIResponder</string>
209+
<string key="-2.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
210+
<string key="1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
211+
<string key="5.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
212+
<string key="7.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
213+
</dictionary>
214+
<dictionary class="NSMutableDictionary" key="unlocalizedProperties"/>
215+
<nil key="activeLocalization"/>
216+
<dictionary class="NSMutableDictionary" key="localizations"/>
217+
<nil key="sourceID"/>
218+
<int key="maxID">18</int>
219+
</object>
220+
<object class="IBClassDescriber" key="IBDocument.Classes">
221+
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
222+
<object class="IBPartialClassDescription">
223+
<string key="className">DemoViewController</string>
224+
<string key="superclassName">UIViewController</string>
225+
<object class="NSMutableDictionary" key="actions">
226+
<string key="NS.key.0">pushAnotherPressed:</string>
227+
<string key="NS.object.0">id</string>
228+
</object>
229+
<object class="NSMutableDictionary" key="actionInfosByName">
230+
<string key="NS.key.0">pushAnotherPressed:</string>
231+
<object class="IBActionInfo" key="NS.object.0">
232+
<string key="name">pushAnotherPressed:</string>
233+
<string key="candidateClassName">id</string>
234+
</object>
235+
</object>
236+
<object class="IBClassDescriptionSource" key="sourceIdentifier">
237+
<string key="majorKey">IBProjectSource</string>
238+
<string key="minorKey">./Classes/DemoViewController.h</string>
239+
</object>
240+
</object>
241+
</array>
242+
</object>
243+
<int key="IBDocument.localizationMode">0</int>
244+
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaTouchFramework</string>
245+
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults">
246+
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS</string>
247+
<real value="1552" key="NS.object.0"/>
248+
</object>
249+
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
250+
<int key="IBDocument.defaultPropertyAccessControl">3</int>
251+
<string key="IBCocoaTouchPluginVersion">2083</string>
252+
</data>
253+
</archive>
Loading
Loading
Loading
Loading
Loading

0 commit comments

Comments
 (0)