Skip to content

Commit a3959ad

Browse files
committed
Example of slideOff
1 parent c693192 commit a3959ad

File tree

4 files changed

+64
-15
lines changed

4 files changed

+64
-15
lines changed

ECSlidingViewController/AppDelegate.m

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,13 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
1616
{
1717
ECSlidingViewController *slidingViewController = (ECSlidingViewController *)self.window.rootViewController;
1818
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Storyboard" bundle:nil];
19-
slidingViewController.underLeftViewController = [storyboard instantiateViewControllerWithIdentifier:@"Menu"];
20-
slidingViewController.topViewController = [storyboard instantiateViewControllerWithIdentifier:@"FirstTop"];
2119

2220
slidingViewController.anchorRightRevealAmount = 280;
2321
slidingViewController.anchorLeftRevealAmount = 280;
2422

23+
slidingViewController.underLeftViewController = [storyboard instantiateViewControllerWithIdentifier:@"Menu"];
24+
slidingViewController.topViewController = [storyboard instantiateViewControllerWithIdentifier:@"FirstTop"];
25+
2526
return YES;
2627
}
2728

ECSlidingViewController/Storyboard.storyboard

Lines changed: 50 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@
1818
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
1919
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
2020
<prototypes>
21-
<tableViewCell contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="MenuItemCell" id="Q6b-sq-8AG">
21+
<tableViewCell contentMode="scaleToFill" selectionStyle="blue" accessoryType="disclosureIndicator" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="MenuItemCell" id="Q6b-sq-8AG">
2222
<rect key="frame" x="0.0" y="22" width="320" height="44"/>
2323
<autoresizingMask key="autoresizingMask"/>
2424
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
25-
<rect key="frame" x="0.0" y="0.0" width="320" height="43"/>
25+
<rect key="frame" x="0.0" y="0.0" width="300" height="43"/>
2626
<autoresizingMask key="autoresizingMask"/>
2727
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
2828
</view>
@@ -102,7 +102,7 @@
102102
<viewController storyboardIdentifier="FirstTop" id="fYD-9N-EQW" customClass="FirstTopViewController" sceneMemberID="viewController">
103103
<view key="view" contentMode="scaleToFill" id="d8v-Bl-Aef">
104104
<rect key="frame" x="0.0" y="20" width="320" height="460"/>
105-
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
105+
<autoresizingMask key="autoresizingMask"/>
106106
<subviews>
107107
<navigationBar contentMode="scaleToFill" id="MXB-nc-Wa5">
108108
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
@@ -129,18 +129,53 @@
129129
</objects>
130130
<point key="canvasLocation" x="216" y="-286"/>
131131
</scene>
132-
<scene sceneID="MiN-Hb-WSf">
132+
<scene sceneID="kzo-vV-v3D">
133133
<objects>
134-
<placeholder placeholderIdentifier="IBFirstResponder" id="gdY-aH-vcn" userLabel="First Responder" sceneMemberID="firstResponder"/>
135-
<viewController storyboardIdentifier="UnderRight" id="9q4-pJ-daA" sceneMemberID="viewController">
136-
<view key="view" contentMode="scaleToFill" id="Spz-rx-G1t">
134+
<placeholder placeholderIdentifier="IBFirstResponder" id="wZR-cS-BX4" userLabel="First Responder" sceneMemberID="firstResponder"/>
135+
<tableViewController storyboardIdentifier="UnderRight" id="Ig4-5y-QXh" customClass="UnderRightViewController" sceneMemberID="viewController">
136+
<tableView key="view" opaque="NO" clipsSubviews="YES" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" id="st9-09-gdI">
137137
<rect key="frame" x="0.0" y="20" width="320" height="460"/>
138-
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
139-
<color key="backgroundColor" red="0.83163265310000001" green="0.83163265310000001" blue="0.83163265310000001" alpha="1" colorSpace="calibratedRGB"/>
140-
</view>
141-
</viewController>
138+
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
139+
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
140+
<searchBar key="tableHeaderView" contentMode="redraw" id="Hcf-8U-dy3">
141+
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
142+
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
143+
<textInputTraits key="textInputTraits"/>
144+
<connections>
145+
<outlet property="delegate" destination="Ig4-5y-QXh" id="1VB-ls-Lcz"/>
146+
</connections>
147+
</searchBar>
148+
<prototypes>
149+
<tableViewCell contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="myCell" id="YbT-yc-nMl">
150+
<rect key="frame" x="0.0" y="66" width="320" height="44"/>
151+
<autoresizingMask key="autoresizingMask"/>
152+
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
153+
<rect key="frame" x="0.0" y="0.0" width="320" height="43"/>
154+
<autoresizingMask key="autoresizingMask"/>
155+
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
156+
</view>
157+
</tableViewCell>
158+
</prototypes>
159+
<connections>
160+
<outlet property="dataSource" destination="Ig4-5y-QXh" id="dpi-MY-Law"/>
161+
<outlet property="delegate" destination="Ig4-5y-QXh" id="QPl-aj-WaV"/>
162+
</connections>
163+
</tableView>
164+
<connections>
165+
<outlet property="searchDisplayController" destination="pGs-mS-Bfe" id="4P8-CS-6r5"/>
166+
</connections>
167+
</tableViewController>
168+
<searchDisplayController id="pGs-mS-Bfe">
169+
<connections>
170+
<outlet property="delegate" destination="Ig4-5y-QXh" id="sGn-oe-3vf"/>
171+
<outlet property="searchBar" destination="Hcf-8U-dy3" id="zP5-Fn-MdF"/>
172+
<outlet property="searchContentsController" destination="Ig4-5y-QXh" id="s4l-SR-ZHm"/>
173+
<outlet property="searchResultsDataSource" destination="Ig4-5y-QXh" id="Zrq-zp-lcI"/>
174+
<outlet property="searchResultsDelegate" destination="Ig4-5y-QXh" id="xuj-lF-ZGa"/>
175+
</connections>
176+
</searchDisplayController>
142177
</objects>
143-
<point key="canvasLocation" x="681" y="-286"/>
178+
<point key="canvasLocation" x="678" y="-287"/>
144179
</scene>
145180
<scene sceneID="OC6-i3-9aC">
146181
<objects>
@@ -182,6 +217,9 @@
182217
<relationship kind="action" name="revealMenu:"/>
183218
</relationships>
184219
</class>
220+
<class className="UnderRightViewController" superclassName="UITableViewController">
221+
<source key="sourceIdentifier" type="project" relativePath="./Classes/UnderRightViewController.h"/>
222+
</class>
185223
</classes>
186224
<simulatedMetricsContainer key="defaultSimulatedMetrics">
187225
<simulatedStatusBarMetrics key="statusBar"/>

ECSlidingViewController/UnderRightViewController.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@
99
#import <UIKit/UIKit.h>
1010
#import "ECSlidingViewController.h"
1111

12-
@interface UnderRightViewController : UIViewController
12+
@interface UnderRightViewController : UITableViewController <UISearchBarDelegate>
1313

1414
@end

ECSlidingViewController/UnderRightViewController.m

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,14 @@
1010

1111
@implementation UnderRightViewController
1212

13+
- (void)searchBarTextDidBeginEditing:(UISearchBar *)searchBar
14+
{
15+
[self.slidingViewController slideOffToLeftOnComplete:nil];
16+
}
17+
18+
- (void)searchBarTextDidEndEditing:(UISearchBar *)searchBar
19+
{
20+
[self.slidingViewController anchorToLeft];
21+
}
22+
1323
@end

0 commit comments

Comments
 (0)