This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Add UINavigationController example.

  • Loading branch information...
enriquez committed Feb 13, 2012
1 parent 2ca6d98 commit c8240bbf5d0e52b870df8cba23aea119667e4a84
@@ -8,6 +8,8 @@
/* Begin PBXBuildFile section */
27407EEC14D8787E0035FD7F /* iPad.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 27407EEB14D8787E0035FD7F /* iPad.storyboard */; };
+ 27498DCE14E96C75005C043E /* NavigationTopViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 27498DCD14E96C75005C043E /* NavigationTopViewController.m */; };
+ 27498DD514E96EEF005C043E /* SampleTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 27498DD414E96EEF005C043E /* SampleTableViewController.m */; };
2750E77114CDB0DF007727A0 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2750E77014CDB0DF007727A0 /* UIKit.framework */; };
2750E77314CDB0DF007727A0 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2750E77214CDB0DF007727A0 /* Foundation.framework */; };
2750E77514CDB0DF007727A0 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2750E77414CDB0DF007727A0 /* CoreGraphics.framework */; };
@@ -28,6 +30,10 @@
/* Begin PBXFileReference section */
27407EEB14D8787E0035FD7F /* iPad.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = iPad.storyboard; sourceTree = "<group>"; };
+ 27498DCC14E96C75005C043E /* NavigationTopViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NavigationTopViewController.h; sourceTree = "<group>"; };
+ 27498DCD14E96C75005C043E /* NavigationTopViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NavigationTopViewController.m; sourceTree = "<group>"; };
+ 27498DD314E96EEF005C043E /* SampleTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SampleTableViewController.h; sourceTree = "<group>"; };
+ 27498DD414E96EEF005C043E /* SampleTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SampleTableViewController.m; sourceTree = "<group>"; };
2750E76C14CDB0DF007727A0 /* ECSlidingViewController.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ECSlidingViewController.app; sourceTree = BUILT_PRODUCTS_DIR; };
2750E77014CDB0DF007727A0 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
2750E77214CDB0DF007727A0 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
@@ -143,6 +149,10 @@
27FC94DF14D0C14E0000B18C /* InitialSlidingViewController.m */,
2750E79214CDB93A007727A0 /* MenuViewController.h */,
2750E79314CDB93A007727A0 /* MenuViewController.m */,
+ 27498DCC14E96C75005C043E /* NavigationTopViewController.h */,
+ 27498DCD14E96C75005C043E /* NavigationTopViewController.m */,
+ 27498DD314E96EEF005C043E /* SampleTableViewController.h */,
+ 27498DD414E96EEF005C043E /* SampleTableViewController.m */,
2750E79814CDB99A007727A0 /* SecondTopViewController.h */,
2750E79914CDB99A007727A0 /* SecondTopViewController.m */,
2750E79B14CDBA48007727A0 /* ThirdTopViewController.h */,
@@ -238,6 +248,8 @@
2750E7AE14CF1306007727A0 /* ECSlidingViewController.m in Sources */,
2750E7AF14CF1306007727A0 /* UIImage+ImageWithUIView.m in Sources */,
27FC94E014D0C14E0000B18C /* InitialSlidingViewController.m in Sources */,
+ 27498DCE14E96C75005C043E /* NavigationTopViewController.m in Sources */,
+ 27498DD514E96EEF005C043E /* SampleTableViewController.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -17,7 +17,7 @@ @implementation MenuViewController
- (void)awakeFromNib
{
- self.menuItems = [NSArray arrayWithObjects:@"First", @"Second", @"Third", nil];
+ self.menuItems = [NSArray arrayWithObjects:@"First", @"Second", @"Third", @"Navigation", nil];
}
- (void)viewDidLoad
@@ -0,0 +1,16 @@
+//
+// NavigationTopViewController.h
+// ECSlidingViewController
+//
+// Created by Michael Enriquez on 2/13/12.
+// Copyright (c) 2012 EdgeCase. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+#import "ECSlidingViewController.h"
+#import "MenuViewController.h"
+#import "UnderRightViewController.h"
+
+@interface NavigationTopViewController : UINavigationController
+
+@end
@@ -0,0 +1,36 @@
+//
+// NavigationTopViewController.m
+// ECSlidingViewController
+//
+// Created by Michael Enriquez on 2/13/12.
+// Copyright (c) 2012 EdgeCase. All rights reserved.
+//
+
+#import "NavigationTopViewController.h"
+
+@implementation NavigationTopViewController
+
+- (void)viewWillAppear:(BOOL)animated
+{
+ [super viewWillAppear:animated];
+
+ UIStoryboard *storyboard;
+
+ if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
+ storyboard = [UIStoryboard storyboardWithName:@"iPhone" bundle:nil];
+ } else if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
+ storyboard = [UIStoryboard storyboardWithName:@"iPad" bundle:nil];
+ }
+
+ if (![self.slidingViewController.underLeftViewController isKindOfClass:[MenuViewController class]]) {
+ self.slidingViewController.underLeftViewController = [storyboard instantiateViewControllerWithIdentifier:@"Menu"];
+ }
+
+ if (![self.slidingViewController.underRightViewController isKindOfClass:[UnderRightViewController class]]) {
+ self.slidingViewController.underRightViewController = [storyboard instantiateViewControllerWithIdentifier:@"UnderRight"];
+ }
+
+ [self.view addGestureRecognizer:self.slidingViewController.panGesture];
+}
+
+@end
@@ -0,0 +1,14 @@
+//
+// SampleTableViewController.h
+// ECSlidingViewController
+//
+// Created by Michael Enriquez on 2/13/12.
+// Copyright (c) 2012 EdgeCase. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+#import "ECSlidingViewController.h"
+
+@interface SampleTableViewController : UITableViewController <UITableViewDataSource, UITabBarControllerDelegate>
+- (IBAction)revealMenu:(id)sender;
+@end
@@ -0,0 +1,46 @@
+//
+// SampleTableViewController.m
+// ECSlidingViewController
+//
+// Created by Michael Enriquez on 2/13/12.
+// Copyright (c) 2012 EdgeCase. All rights reserved.
+//
+
+#import "SampleTableViewController.h"
+
+@interface SampleTableViewController()
+@property (nonatomic, strong) NSArray *sampleItems;
+@end
+
+@implementation SampleTableViewController
+@synthesize sampleItems;
+
+- (void)awakeFromNib
+{
+ self.sampleItems = [NSArray arrayWithObjects:@"One", @"Two", @"Three", nil];
+}
+
+- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)sectionIndex
+{
+ return self.sampleItems.count;
+}
+
+- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
+{
+ NSString *cellIdentifier = @"SampleCell";
+ UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
+ if (cell == nil) {
+ cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:cellIdentifier];
+ }
+
+ cell.textLabel.text = [self.sampleItems objectAtIndex:indexPath.row];
+
+ return cell;
+}
+
+- (IBAction)revealMenu:(id)sender
+{
+ [self.slidingViewController anchorTopViewTo:ECRight animations:nil onComplete:nil];
+}
+
+@end
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="1.0" toolsVersion="1938" systemVersion="11C74" targetRuntime="iOS.CocoaTouch.iPad" propertyAccessControl="none" initialViewController="SIb-O2-Xa4">
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="1.0" toolsVersion="1938" systemVersion="11D50" targetRuntime="iOS.CocoaTouch.iPad" propertyAccessControl="none" initialViewController="SIb-O2-Xa4">
<dependencies>
<development defaultVersion="4200" identifier="xcode"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="933"/>
@@ -85,6 +85,66 @@
</objects>
<point key="canvasLocation" x="1366" y="-3472"/>
</scene>
+ <scene sceneID="9Lf-Ds-7hE">
+ <objects>
+ <placeholder placeholderIdentifier="IBFirstResponder" id="iCA-AT-FmW" userLabel="First Responder" sceneMemberID="firstResponder"/>
+ <viewController id="7TO-m0-aL5" sceneMemberID="viewController">
+ <view key="view" contentMode="scaleToFill" id="Wly-m0-fDF">
+ <rect key="frame" x="0.0" y="64" width="768" height="960"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+ <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
+ </view>
+ <navigationItem key="navigationItem" id="voj-fx-Y0v"/>
+ </viewController>
+ </objects>
+ <point key="canvasLocation" x="3128" y="-4635"/>
+ </scene>
+ <scene sceneID="uTs-LF-eUf">
+ <objects>
+ <placeholder placeholderIdentifier="IBFirstResponder" id="Mkw-MZ-h1g" userLabel="First Responder" sceneMemberID="firstResponder"/>
+ <navigationController storyboardIdentifier="NavigationTop" definesPresentationContext="YES" id="1hx-oA-DgE" customClass="NavigationTopViewController" sceneMemberID="viewController">
+ <navigationBar key="navigationBar" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" id="vlA-OI-a5q">
+ <autoresizingMask key="autoresizingMask"/>
+ </navigationBar>
+ <connections>
+ <segue destination="NXj-9U-Y8g" kind="relationship" relationship="rootViewController" id="bjU-iw-BID"/>
+ </connections>
+ </navigationController>
+ </objects>
+ <point key="canvasLocation" x="1366" y="-4635"/>
+ </scene>
+ <scene sceneID="ZSn-tl-r3h">
+ <objects>
+ <placeholder placeholderIdentifier="IBFirstResponder" id="0q0-M8-OFj" userLabel="First Responder" sceneMemberID="firstResponder"/>
+ <tableViewController id="NXj-9U-Y8g" customClass="SampleTableViewController" sceneMemberID="viewController">
+ <tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" id="kNR-UP-LbH">
+ <rect key="frame" x="0.0" y="64" width="768" height="960"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+ <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+ <prototypes>
+ <tableViewCell contentMode="scaleToFill" selectionStyle="blue" accessoryType="disclosureIndicator" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="SampleCell" id="tZ1-2i-beG">
+ <rect key="frame" x="0.0" y="22" width="768" height="44"/>
+ <autoresizingMask key="autoresizingMask"/>
+ <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
+ <rect key="frame" x="0.0" y="0.0" width="748" height="43"/>
+ <autoresizingMask key="autoresizingMask"/>
+ <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
+ </view>
+ <connections>
+ <segue destination="7TO-m0-aL5" kind="push" id="jdF-xA-4Z1"/>
+ </connections>
+ </tableViewCell>
+ </prototypes>
+ <connections>
+ <outlet property="dataSource" destination="NXj-9U-Y8g" id="cYZ-fh-wB2"/>
+ <outlet property="delegate" destination="NXj-9U-Y8g" id="3LL-BN-9x0"/>
+ </connections>
+ </tableView>
+ <navigationItem key="navigationItem" id="wWQ-ug-3ai"/>
+ </tableViewController>
+ </objects>
+ <point key="canvasLocation" x="2228" y="-4635"/>
+ </scene>
<scene sceneID="krM-pN-5xZ">
<objects>
<placeholder placeholderIdentifier="IBFirstResponder" id="sXC-W5-s9Y" userLabel="First Responder" sceneMemberID="firstResponder"/>
@@ -197,6 +257,15 @@
<class className="MenuViewController" superclassName="UIViewController">
<source key="sourceIdentifier" type="project" relativePath="./Classes/MenuViewController.h"/>
</class>
+ <class className="NavigationTopViewController" superclassName="UINavigationController">
+ <source key="sourceIdentifier" type="project" relativePath="./Classes/NavigationTopViewController.h"/>
+ </class>
+ <class className="SampleTableViewController" superclassName="UITableViewController">
+ <source key="sourceIdentifier" type="project" relativePath="./Classes/SampleTableViewController.h"/>
+ <relationships>
+ <relationship kind="action" name="revealMenu:"/>
+ </relationships>
+ </class>
<class className="SecondTopViewController" superclassName="UIViewController">
<source key="sourceIdentifier" type="project" relativePath="./Classes/SecondTopViewController.h"/>
<relationships>
Oops, something went wrong.

0 comments on commit c8240bb

Please sign in to comment.