├── backgroundImage_repeat.png
├── StackScrollView-Info.plist
├── License
├── StackScrollView_Prefix.pch
├── Classes
├── UIViewWithShadow.h
├── MenuViewController.h
├── DataViewController.h
├── StackScrollViewAppDelegate.h
├── RootViewController.h
├── UIViewWithShadow.m
├── StackScrollViewController.h
├── StackScrollViewAppDelegate.m
├── DataViewController.m
├── MenuViewController.m
├── RootViewController.m
└── StackScrollViewController.m
├── main.m
├── README.mdown
├── StackScrollView.xcodeproj
└── project.pbxproj
└── MainWindow.xib
/backgroundImage_repeat.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raweng/stack-scroll-view/HEAD/backgroundImage_repeat.png
--------------------------------------------------------------------------------
/StackScrollView-Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | English
7 | CFBundleDisplayName
8 | ${PRODUCT_NAME}
9 | CFBundleExecutable
10 | ${EXECUTABLE_NAME}
11 | CFBundleIconFile
12 |
13 | CFBundleIdentifier
14 | com.yourcompany.${PRODUCT_NAME:rfc1034identifier}
15 | CFBundleInfoDictionaryVersion
16 | 6.0
17 | CFBundleName
18 | ${PRODUCT_NAME}
19 | CFBundlePackageType
20 | APPL
21 | CFBundleSignature
22 | ????
23 | CFBundleVersion
24 | 1.0
25 | LSRequiresIPhoneOS
26 |
27 | NSMainNibFile
28 | MainWindow
29 | UISupportedInterfaceOrientations
30 |
31 | UIInterfaceOrientationPortrait
32 | UIInterfaceOrientationPortraitUpsideDown
33 | UIInterfaceOrientationLandscapeLeft
34 | UIInterfaceOrientationLandscapeRight
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/License:
--------------------------------------------------------------------------------
1 | This module is licenced under the BSD license.
2 |
3 | Copyright (C) 2011 by raw engineering .
4 |
5 | All rights reserved.
6 |
7 | Redistribution and use in source and binary forms, with or without
8 | modification, are permitted provided that the following conditions
9 | are met:
10 |
11 | * Redistributions of source code must retain the above copyright
12 | notice, this list of conditions and the following disclaimer.
13 |
14 | * Redistributions in binary form must reproduce the above copyright
15 | notice, this list of conditions and the following disclaimer in the
16 | documentation and/or other materials provided with the distribution.
17 |
18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 | HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
24 | TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
25 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
26 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------------
/StackScrollView_Prefix.pch:
--------------------------------------------------------------------------------
1 | /*
2 | This module is licenced under the BSD license.
3 |
4 | Copyright (C) 2011 by raw engineering .
5 |
6 | All rights reserved.
7 |
8 | Redistribution and use in source and binary forms, with or without
9 | modification, are permitted provided that the following conditions
10 | are met:
11 |
12 | * Redistributions of source code must retain the above copyright
13 | notice, this list of conditions and the following disclaimer.
14 |
15 | * Redistributions in binary form must reproduce the above copyright
16 | notice, this list of conditions and the following disclaimer in the
17 | documentation and/or other materials provided with the distribution.
18 |
19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 | HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
25 | TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 | */
31 | //
32 |
33 | #ifdef __OBJC__
34 | #import
35 | #import
36 | #import
37 |
38 | #endif
39 |
--------------------------------------------------------------------------------
/Classes/UIViewWithShadow.h:
--------------------------------------------------------------------------------
1 | /*
2 | This module is licenced under the BSD license.
3 |
4 | Copyright (C) 2011 by raw engineering .
5 |
6 | All rights reserved.
7 |
8 | Redistribution and use in source and binary forms, with or without
9 | modification, are permitted provided that the following conditions
10 | are met:
11 |
12 | * Redistributions of source code must retain the above copyright
13 | notice, this list of conditions and the following disclaimer.
14 |
15 | * Redistributions in binary form must reproduce the above copyright
16 | notice, this list of conditions and the following disclaimer in the
17 | documentation and/or other materials provided with the distribution.
18 |
19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 | HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
25 | TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 | */
31 |
32 | //
33 | // UIView+Extention.h
34 | // StackScrollView
35 | //
36 | // Created by Reefaq on 2/25/11.
37 | // Copyright 2011 raw engineering . All rights reserved.
38 | //
39 |
40 | #import
41 |
42 |
43 |
44 | @interface UIViewWithShadow : UIView {
45 | CGRect _coloredBoxRect;
46 | }
47 | @end
48 |
--------------------------------------------------------------------------------
/main.m:
--------------------------------------------------------------------------------
1 | /*
2 | This module is licenced under the BSD license.
3 |
4 | Copyright (C) 2011 by raw engineering .
5 |
6 | All rights reserved.
7 |
8 | Redistribution and use in source and binary forms, with or without
9 | modification, are permitted provided that the following conditions
10 | are met:
11 |
12 | * Redistributions of source code must retain the above copyright
13 | notice, this list of conditions and the following disclaimer.
14 |
15 | * Redistributions in binary form must reproduce the above copyright
16 | notice, this list of conditions and the following disclaimer in the
17 | documentation and/or other materials provided with the distribution.
18 |
19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 | HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
25 | TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 | */
31 | //
32 | // main.m
33 | // StackScrollView
34 | //
35 | // Created by Reefaq on 2/24/11.
36 | // Copyright 2011 raw engineering . All rights reserved.
37 | //
38 |
39 | #import
40 |
41 | int main(int argc, char *argv[]) {
42 |
43 | NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
44 | int retVal = UIApplicationMain(argc, argv, nil, nil);
45 | [pool release];
46 | return retVal;
47 | }
48 |
--------------------------------------------------------------------------------
/Classes/MenuViewController.h:
--------------------------------------------------------------------------------
1 | /*
2 | This module is licenced under the BSD license.
3 |
4 | Copyright (C) 2011 by raw engineering .
5 |
6 | All rights reserved.
7 |
8 | Redistribution and use in source and binary forms, with or without
9 | modification, are permitted provided that the following conditions
10 | are met:
11 |
12 | * Redistributions of source code must retain the above copyright
13 | notice, this list of conditions and the following disclaimer.
14 |
15 | * Redistributions in binary form must reproduce the above copyright
16 | notice, this list of conditions and the following disclaimer in the
17 | documentation and/or other materials provided with the distribution.
18 |
19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 | HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
25 | TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 | */
31 | //
32 | // MenuViewController.h
33 | // StackScrollView
34 | //
35 | // Created by Reefaq on 2/24/11.
36 | // Copyright 2011 raw engineering . All rights reserved.
37 | //
38 |
39 | #import
40 |
41 |
42 | @interface MenuViewController : UIViewController {
43 | UITableView* _tableView;
44 | }
45 | - (id)initWithFrame:(CGRect)frame;
46 |
47 | @property(nonatomic, retain)UITableView* tableView;
48 |
49 | @end
50 |
--------------------------------------------------------------------------------
/Classes/DataViewController.h:
--------------------------------------------------------------------------------
1 | /*
2 | This module is licenced under the BSD license.
3 |
4 | Copyright (C) 2011 by raw engineering .
5 |
6 | All rights reserved.
7 |
8 | Redistribution and use in source and binary forms, with or without
9 | modification, are permitted provided that the following conditions
10 | are met:
11 |
12 | * Redistributions of source code must retain the above copyright
13 | notice, this list of conditions and the following disclaimer.
14 |
15 | * Redistributions in binary form must reproduce the above copyright
16 | notice, this list of conditions and the following disclaimer in the
17 | documentation and/or other materials provided with the distribution.
18 |
19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 | HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
25 | TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 | */
31 | //
32 | // DataViewController.h
33 | // StackScrollView
34 | //
35 | // Created by Reefaq on 2/24/11.
36 | // Copyright 2011 raw engineering . All rights reserved.
37 | //
38 |
39 | #import
40 |
41 | @interface DataViewController : UIViewController {
42 | UITableView* _tableView;
43 | }
44 |
45 | - (id)initWithFrame:(CGRect)frame;
46 |
47 |
48 | @property(nonatomic, retain)UITableView* tableView;
49 |
50 | @end
51 |
--------------------------------------------------------------------------------
/Classes/StackScrollViewAppDelegate.h:
--------------------------------------------------------------------------------
1 | /*
2 | This module is licenced under the BSD license.
3 |
4 | Copyright (C) 2011 by raw engineering .
5 |
6 | All rights reserved.
7 |
8 | Redistribution and use in source and binary forms, with or without
9 | modification, are permitted provided that the following conditions
10 | are met:
11 |
12 | * Redistributions of source code must retain the above copyright
13 | notice, this list of conditions and the following disclaimer.
14 |
15 | * Redistributions in binary form must reproduce the above copyright
16 | notice, this list of conditions and the following disclaimer in the
17 | documentation and/or other materials provided with the distribution.
18 |
19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 | HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
25 | TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 | */
31 | //
32 | // StackScrollViewAppDelegate.h
33 | // StackScrollView
34 | //
35 | // Created by Reefaq on 2/24/11.
36 | // Copyright 2011 raw engineering . All rights reserved.
37 | //
38 |
39 | #import
40 |
41 | @class RootViewController;
42 |
43 | @interface StackScrollViewAppDelegate : NSObject {
44 | UIWindow *window;
45 | RootViewController *rootViewController;
46 | }
47 |
48 | + (StackScrollViewAppDelegate *) instance;
49 |
50 | @property (nonatomic, retain) IBOutlet UIWindow *window;
51 | @property (nonatomic, retain) RootViewController *rootViewController;
52 |
53 | @end
54 |
55 |
--------------------------------------------------------------------------------
/Classes/RootViewController.h:
--------------------------------------------------------------------------------
1 | /*
2 | This module is licenced under the BSD license.
3 |
4 | Copyright (C) 2011 by raw engineering .
5 |
6 | All rights reserved.
7 |
8 | Redistribution and use in source and binary forms, with or without
9 | modification, are permitted provided that the following conditions
10 | are met:
11 |
12 | * Redistributions of source code must retain the above copyright
13 | notice, this list of conditions and the following disclaimer.
14 |
15 | * Redistributions in binary form must reproduce the above copyright
16 | notice, this list of conditions and the following disclaimer in the
17 | documentation and/or other materials provided with the distribution.
18 |
19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 | HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
25 | TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 | */
31 | //
32 | // RootView.h
33 | // StackScrollView
34 | //
35 | // Created by Reefaq on 2/24/11.
36 | // Copyright 2011 raw engineering . All rights reserved.
37 | //
38 |
39 | #import
40 |
41 |
42 | @class MenuViewController;
43 | @class StackScrollViewController;
44 |
45 | @class UIViewExt;
46 |
47 | @interface RootViewController : UIViewController {
48 | UIViewExt* rootView;
49 | UIView* leftMenuView;
50 | UIView* rightSlideView;
51 |
52 | MenuViewController* menuViewController;
53 | StackScrollViewController* stackScrollViewController;
54 |
55 | }
56 |
57 | @property (nonatomic, retain) MenuViewController* menuViewController;
58 | @property (nonatomic, retain) StackScrollViewController* stackScrollViewController;
59 |
60 |
61 | @end
62 |
--------------------------------------------------------------------------------
/README.mdown:
--------------------------------------------------------------------------------
1 | StackScrollView Like Twitter iPad App
2 | ============================================================
3 |
4 | StackScrollView project is a demo app for creating view like twitter app for ipad, created by the mobile development team at [raw engineering][]. Also checkout our [FlipView Project][]
5 |
6 | Note: this project is only for iPad under Xcode version 3.2.5
7 |
8 | StackScrollView is a simple way to present a sliding view interface similar to Twitter's iPad App. It comprises of three classes, RootViewController,MenuViewController and StackScrollViewController.
9 |
10 |
11 |
12 | StackScrollView supports :
13 |
14 | - Orientation (both Landscape & Portrait)
15 |
16 | - Swipe Gestures
17 |
18 | - Bouncing Effect
19 |
20 | [](http://farm6.static.flickr.com/5027/5702558111_f122930337_b.jpg)
21 | [](http://farm3.static.flickr.com/2268/5703108996_27ee68a5ff_b.jpg)
22 | [](http://farm3.static.flickr.com/2352/5702551281_2de9ec82c7_b.jpg)
23 | [](http://farm4.static.flickr.com/3238/5703122950_d0a341bf74_b.jpg)
24 |
25 | Installation
26 | ==============================
27 |
28 | Add RootViewController,MenuViewController and StackScrollViewController files to your Xcode project.
29 |
30 |
31 | Getting Started
32 | ==============================
33 |
34 | StackScrollViewController is a main content area, to add view in StackScrollViewController you need to add your controller object in its method named
35 |
36 | - (void) addViewInSlider:(UIViewController*)controller invokeByController:(UIViewController*)invokeByController isStackStartView:(BOOL)isStackStartView;
37 |
38 | parameter:
39 |
40 | - controller : object of a controller whose view should be added
41 |
42 | - invokeByController: object of a controller from where it has been invoked
43 |
44 | - isStackStartView : set this to TRUE/YES if you need to place this controller's view at very first position (Note: all the other view in view stack will be removed), set this to FALSE/NO if you need to place this controller's view in stack hierarchy
45 |
46 | Help
47 | =========
48 |
49 | Please submit your questions to the blog link provided below:
50 |
51 | * [raw engineering blog][]
52 |
53 |
54 |
55 | [raw engineering]:http://www.raweng.com
56 | [raw engineering blog]:http://www.raweng.com/blog/stack-scroll-view/
57 | [FlipView Project]:https://github.com/raweng/FlipView
--------------------------------------------------------------------------------
/Classes/UIViewWithShadow.m:
--------------------------------------------------------------------------------
1 | /*
2 | This module is licenced under the BSD license.
3 |
4 | Copyright (C) 2011 by raw engineering .
5 |
6 | All rights reserved.
7 |
8 | Redistribution and use in source and binary forms, with or without
9 | modification, are permitted provided that the following conditions
10 | are met:
11 |
12 | * Redistributions of source code must retain the above copyright
13 | notice, this list of conditions and the following disclaimer.
14 |
15 | * Redistributions in binary form must reproduce the above copyright
16 | notice, this list of conditions and the following disclaimer in the
17 | documentation and/or other materials provided with the distribution.
18 |
19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 | HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
25 | TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 | */
31 | //
32 | // UIView+Extention.m
33 | // StackScrollView
34 | //
35 | // Created by Reefaq on 2/25/11.
36 | // Copyright 2011 raw engineering . All rights reserved.
37 | //
38 |
39 | #import "UIViewWithShadow.h"
40 |
41 |
42 | @implementation UIViewWithShadow
43 |
44 |
45 | - (id)init {
46 | if ((self = [super init])) {
47 | self.backgroundColor = [UIColor clearColor];
48 | self.opaque = NO;
49 | }
50 | return self;
51 | }
52 |
53 | -(void) layoutSubviews {
54 | CGFloat coloredBoxMargin = 40;
55 | CGFloat coloredBoxHeight = self.frame.size.height;
56 | _coloredBoxRect = CGRectMake(coloredBoxMargin,
57 | 0,
58 | 40,
59 | coloredBoxHeight);
60 | }
61 |
62 | -(void) drawRect:(CGRect)rect {
63 |
64 | CGColorRef lightColor = [UIColor colorWithRed:105.0f/255.0f green:179.0f/255.0f blue:216.0f/255.0f alpha:0.8].CGColor;
65 |
66 | CGColorRef shadowColor = [UIColor colorWithRed:0.2 green:0.2 blue:0.2 alpha:0.4].CGColor;
67 |
68 | CGContextRef context = UIGraphicsGetCurrentContext();
69 | // Draw shadow
70 | CGContextSaveGState(context);
71 | CGContextSetShadowWithColor(context, CGSizeMake(-5, 0), 10, shadowColor);
72 | CGContextSetFillColorWithColor(context, lightColor);
73 | CGContextFillRect(context, _coloredBoxRect);
74 | CGContextRestoreGState(context);
75 | }
76 |
77 | @end
78 |
--------------------------------------------------------------------------------
/Classes/StackScrollViewController.h:
--------------------------------------------------------------------------------
1 | /*
2 | This module is licenced under the BSD license.
3 |
4 | Copyright (C) 2011 by raw engineering .
5 |
6 | All rights reserved.
7 |
8 | Redistribution and use in source and binary forms, with or without
9 | modification, are permitted provided that the following conditions
10 | are met:
11 |
12 | * Redistributions of source code must retain the above copyright
13 | notice, this list of conditions and the following disclaimer.
14 |
15 | * Redistributions in binary form must reproduce the above copyright
16 | notice, this list of conditions and the following disclaimer in the
17 | documentation and/or other materials provided with the distribution.
18 |
19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 | HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
25 | TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 | */
31 | //
32 | // StackScrollViewController.h
33 | // StackScrollView
34 | //
35 | // Created by Reefaq Mohammed Mac Pro on 5/10/11.
36 | // Copyright 2011 raw engineering. All rights reserved.
37 | //
38 |
39 | #import
40 |
41 |
42 | @interface StackScrollViewController : UIViewController {
43 |
44 | UIView* slideViews;
45 | UIView* borderViews;
46 |
47 | UIView* viewAtLeft;
48 | UIView* viewAtRight;
49 | UIView* viewAtLeft2;
50 | UIView* viewAtRight2;
51 | UIView* viewAtRightAtTouchBegan;
52 | UIView* viewAtLeftAtTouchBegan;
53 |
54 | NSMutableArray* viewControllersStack;
55 |
56 | NSString* dragDirection;
57 |
58 | CGFloat viewXPosition;
59 | CGFloat displacementPosition;
60 | CGFloat lastTouchPoint;
61 | CGFloat slideStartPosition;
62 |
63 | CGPoint positionOfViewAtRightAtTouchBegan;
64 | CGPoint positionOfViewAtLeftAtTouchBegan;
65 |
66 |
67 |
68 | }
69 |
70 | - (void) addViewInSlider:(UIViewController*)controller invokeByController:(UIViewController*)invokeByController isStackStartView:(BOOL)isStackStartView;
71 | - (void)bounceBack:(NSString*)animationID finished:(NSNumber*)finished context:(void*)context;
72 |
73 | @property (nonatomic, retain) UIView* slideViews;
74 | @property (nonatomic, retain) UIView* borderViews;
75 | @property (nonatomic, assign) CGFloat slideStartPosition;
76 | @property (nonatomic, assign) NSMutableArray* viewControllersStack;
77 |
78 |
79 |
80 | @end
81 |
--------------------------------------------------------------------------------
/Classes/StackScrollViewAppDelegate.m:
--------------------------------------------------------------------------------
1 | /*
2 | This module is licenced under the BSD license.
3 |
4 | Copyright (C) 2011 by raw engineering .
5 |
6 | All rights reserved.
7 |
8 | Redistribution and use in source and binary forms, with or without
9 | modification, are permitted provided that the following conditions
10 | are met:
11 |
12 | * Redistributions of source code must retain the above copyright
13 | notice, this list of conditions and the following disclaimer.
14 |
15 | * Redistributions in binary form must reproduce the above copyright
16 | notice, this list of conditions and the following disclaimer in the
17 | documentation and/or other materials provided with the distribution.
18 |
19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 | HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
25 | TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 | */
31 | //
32 | // StackScrollViewAppDelegate.m
33 | // StackScrollView
34 | //
35 | // Created by Reefaq on 2/24/11.
36 | // Copyright 2011 raw engineering . All rights reserved.
37 | //
38 |
39 | #import "StackScrollViewAppDelegate.h"
40 | #import "RootViewController.h"
41 | @implementation StackScrollViewAppDelegate
42 |
43 | @synthesize window;
44 | @synthesize rootViewController;
45 |
46 |
47 |
48 | + (StackScrollViewAppDelegate *) instance {
49 | return (StackScrollViewAppDelegate *) [[UIApplication sharedApplication] delegate];
50 | }
51 |
52 |
53 | #pragma mark -
54 | #pragma mark Application lifecycle
55 |
56 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
57 |
58 | rootViewController = [[RootViewController alloc] initWithNibName:nil bundle:nil];
59 | [self.window setBackgroundColor:[UIColor clearColor]];
60 | [self.window addSubview:rootViewController.view];
61 | [self.window makeKeyAndVisible];
62 |
63 | return YES;
64 | }
65 |
66 |
67 | - (void)applicationWillResignActive:(UIApplication *)application {
68 | /*
69 | Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
70 | Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
71 | */
72 | }
73 |
74 |
75 | - (void)applicationDidBecomeActive:(UIApplication *)application {
76 | /*
77 | Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
78 | */
79 | }
80 |
81 |
82 | - (void)applicationWillTerminate:(UIApplication *)application {
83 | /*
84 | Called when the application is about to terminate.
85 | See also applicationDidEnterBackground:.
86 | */
87 | }
88 |
89 |
90 | #pragma mark -
91 | #pragma mark Memory management
92 |
93 | - (void)applicationDidReceiveMemoryWarning:(UIApplication *)application {
94 | /*
95 | Free up as much memory as possible by purging cached data objects that can be recreated (or reloaded from disk) later.
96 | */
97 | }
98 |
99 |
100 | - (void)dealloc {
101 | [rootViewController release];
102 | [window release];
103 | [super dealloc];
104 | }
105 |
106 |
107 | @end
108 |
--------------------------------------------------------------------------------
/Classes/DataViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | /*
3 | This module is licenced under the BSD license.
4 |
5 | Copyright (C) 2011 by raw engineering .
6 |
7 | All rights reserved.
8 |
9 | Redistribution and use in source and binary forms, with or without
10 | modification, are permitted provided that the following conditions
11 | are met:
12 |
13 | * Redistributions of source code must retain the above copyright
14 | notice, this list of conditions and the following disclaimer.
15 |
16 | * Redistributions in binary form must reproduce the above copyright
17 | notice, this list of conditions and the following disclaimer in the
18 | documentation and/or other materials provided with the distribution.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
26 | TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 | // DataViewController.m
33 | // StackScrollView
34 | //
35 | // Created by Reefaq on 2/24/11.
36 | // Copyright 2011 raw engineering . All rights reserved.
37 | //
38 |
39 | #import "DataViewController.h"
40 | #import "StackScrollViewAppDelegate.h"
41 | #import "RootViewController.h"
42 | #import "StackScrollViewController.h"
43 |
44 | @implementation DataViewController
45 | @synthesize tableView = _tableView;
46 |
47 | #pragma mark -
48 | #pragma mark View lifecycle
49 |
50 | - (id)initWithFrame:(CGRect)frame {
51 | if (self = [super init]) {
52 | [self.view setFrame:frame];
53 |
54 | _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height) style:UITableViewStylePlain];
55 | [_tableView setDelegate:self];
56 | [_tableView setDataSource:self];
57 |
58 | UIView* footerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 1)];
59 | _tableView.tableFooterView = footerView;
60 | [footerView release];
61 |
62 | [_tableView setAutoresizingMask:UIViewAutoresizingFlexibleHeight];
63 | [self.view addSubview:_tableView];
64 | }
65 | return self;
66 | }
67 |
68 |
69 | - (void)viewDidLoad {
70 | [super viewDidLoad];
71 | }
72 |
73 |
74 | - (void)viewDidAppear:(BOOL)animated {
75 | [super viewDidAppear:animated];
76 |
77 | }
78 |
79 |
80 | - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
81 | // Override to allow orientations other than the default portrait orientation.
82 | return YES;
83 | }
84 |
85 |
86 | #pragma mark -
87 | #pragma mark Table view data source
88 |
89 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
90 | // Return the number of sections.
91 | return 1;
92 | }
93 |
94 |
95 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
96 | // Return the number of rows in the section.
97 | return 5;
98 | }
99 |
100 |
101 | // Customize the appearance of table view cells.
102 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
103 |
104 | static NSString *CellIdentifier = @"Cell";
105 |
106 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
107 | if (cell == nil) {
108 | cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
109 | }
110 |
111 | // Configure the cell...
112 | cell.textLabel.text = [NSString stringWithFormat:@"Data %d", indexPath.row];
113 | cell.textLabel.textColor = [UIColor blackColor];
114 |
115 | return cell;
116 | }
117 |
118 |
119 | #pragma mark -
120 | #pragma mark Table view delegate
121 |
122 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
123 | DataViewController *dataViewController = [[DataViewController alloc] initWithFrame:CGRectMake(0, 0, 477, self.view.frame.size.height)];
124 | [[StackScrollViewAppDelegate instance].rootViewController.stackScrollViewController addViewInSlider:dataViewController invokeByController:self isStackStartView:FALSE];
125 | [dataViewController release];
126 | }
127 |
128 |
129 | #pragma mark -
130 | #pragma mark Memory management
131 |
132 | - (void)didReceiveMemoryWarning {
133 | [super didReceiveMemoryWarning];
134 | }
135 |
136 | - (void)viewDidUnload {
137 | }
138 |
139 |
140 | - (void)dealloc {
141 | [super dealloc];
142 | }
143 |
144 |
145 | @end
146 |
147 |
--------------------------------------------------------------------------------
/Classes/MenuViewController.m:
--------------------------------------------------------------------------------
1 | /*
2 | This module is licenced under the BSD license.
3 |
4 | Copyright (C) 2011 by raw engineering .
5 |
6 | All rights reserved.
7 |
8 | Redistribution and use in source and binary forms, with or without
9 | modification, are permitted provided that the following conditions
10 | are met:
11 |
12 | * Redistributions of source code must retain the above copyright
13 | notice, this list of conditions and the following disclaimer.
14 |
15 | * Redistributions in binary form must reproduce the above copyright
16 | notice, this list of conditions and the following disclaimer in the
17 | documentation and/or other materials provided with the distribution.
18 |
19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 | HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
25 | TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 | */
31 | //
32 | // MenuViewController.m
33 | // StackScrollView
34 | //
35 | // Created by Reefaq on 2/24/11.
36 | // Copyright 2011 raw engineering . All rights reserved.
37 | //
38 |
39 | #import "MenuViewController.h"
40 | #import "DataViewController.h"
41 | #import "StackScrollViewAppDelegate.h"
42 | #import "RootViewController.h"
43 | #import "StackScrollViewController.h"
44 |
45 | @implementation MenuViewController
46 | @synthesize tableView = _tableView;
47 |
48 |
49 | #pragma mark -
50 | #pragma mark View lifecycle
51 |
52 | - (id)initWithFrame:(CGRect)frame {
53 | if (self = [super init]) {
54 | [self.view setFrame:frame];
55 |
56 | _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height) style:UITableViewStylePlain];
57 | [_tableView setDelegate:self];
58 | [_tableView setDataSource:self];
59 | [_tableView setBackgroundColor:[UIColor clearColor]];
60 |
61 | UIView* footerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 1)];
62 | _tableView.tableFooterView = footerView;
63 | [footerView release];
64 |
65 | [self.view addSubview:_tableView];
66 |
67 | UIView* verticalLineView = [[UIView alloc] initWithFrame:CGRectMake(self.view.frame.size.width, -5, 1, self.view.frame.size.height)];
68 | [verticalLineView setAutoresizingMask:UIViewAutoresizingFlexibleHeight];
69 | [verticalLineView setBackgroundColor:[UIColor whiteColor]];
70 | [self.view addSubview:verticalLineView];
71 | [self.view bringSubviewToFront:verticalLineView];
72 | [verticalLineView release];
73 |
74 | }
75 | return self;
76 | }
77 |
78 | - (void)viewDidLoad {
79 | [super viewDidLoad];
80 | }
81 |
82 |
83 |
84 | - (void)viewWillAppear:(BOOL)animated {
85 | [super viewWillAppear:animated];
86 | }
87 |
88 |
89 | - (void)viewDidAppear:(BOOL)animated {
90 | [super viewDidAppear:animated];
91 | }
92 |
93 | -(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration{
94 | [super willRotateToInterfaceOrientation:toInterfaceOrientation duration:duration];
95 | }
96 |
97 | - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
98 | // Override to allow orientations other than the default portrait orientation.
99 | return YES;
100 | }
101 |
102 |
103 | #pragma mark -
104 | #pragma mark Table view data source
105 |
106 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
107 | // Return the number of sections.
108 | return 1;
109 | }
110 |
111 |
112 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
113 | // Return the number of rows in the section.
114 | return 10;
115 | }
116 |
117 |
118 | // Customize the appearance of table view cells.
119 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
120 | static NSString *CellIdentifier = @"Cell";
121 |
122 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
123 | if (cell == nil) {
124 | cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
125 | UIView* bgView = [[[UIView alloc] init] autorelease];
126 | [bgView setBackgroundColor:[UIColor colorWithWhite:2 alpha:0.2]];
127 | [cell setSelectedBackgroundView:bgView];
128 | }
129 |
130 | // Configure the cell...
131 | cell.textLabel.text = [NSString stringWithFormat:@"Menu %d", indexPath.row +1];
132 | [cell.textLabel setTextColor:[UIColor whiteColor]];
133 |
134 |
135 | return cell;
136 | }
137 |
138 |
139 | #pragma mark -
140 | #pragma mark Table view delegate
141 |
142 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
143 | DataViewController *dataViewController = [[DataViewController alloc] initWithFrame:CGRectMake(0, 0, 477, self.view.frame.size.height)];
144 | [[StackScrollViewAppDelegate instance].rootViewController.stackScrollViewController addViewInSlider:dataViewController invokeByController:self isStackStartView:TRUE];
145 | [dataViewController release];
146 | }
147 |
148 |
149 | #pragma mark -
150 | #pragma mark Memory management
151 |
152 | - (void)didReceiveMemoryWarning {
153 | [super didReceiveMemoryWarning];
154 | }
155 |
156 | - (void)viewDidUnload {
157 | }
158 |
159 |
160 | - (void)dealloc {
161 | [_tableView release];
162 | [super dealloc];
163 | }
164 |
165 |
166 | @end
167 |
168 |
--------------------------------------------------------------------------------
/Classes/RootViewController.m:
--------------------------------------------------------------------------------
1 | /*
2 | This module is licenced under the BSD license.
3 |
4 | Copyright (C) 2011 by raw engineering .
5 |
6 | All rights reserved.
7 |
8 | Redistribution and use in source and binary forms, with or without
9 | modification, are permitted provided that the following conditions
10 | are met:
11 |
12 | * Redistributions of source code must retain the above copyright
13 | notice, this list of conditions and the following disclaimer.
14 |
15 | * Redistributions in binary form must reproduce the above copyright
16 | notice, this list of conditions and the following disclaimer in the
17 | documentation and/or other materials provided with the distribution.
18 |
19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 | HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
25 | TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 | */
31 | //
32 | // RootView.m
33 | // StackScrollView
34 | //
35 | // Created by Reefaq on 2/24/11.
36 | // Copyright 2011 raw engineering . All rights reserved.
37 | //
38 |
39 | #import "RootViewController.h"
40 |
41 |
42 | #import "MenuViewController.h"
43 | #import "StackScrollViewController.h"
44 |
45 |
46 | @interface UIViewExt : UIView {}
47 | @end
48 |
49 |
50 | @implementation UIViewExt
51 | - (UIView *) hitTest: (CGPoint) pt withEvent: (UIEvent *) event
52 | {
53 |
54 | UIView* viewToReturn=nil;
55 | CGPoint pointToReturn;
56 |
57 | UIView* uiRightView = (UIView*)[[self subviews] objectAtIndex:1];
58 |
59 | if ([[uiRightView subviews] objectAtIndex:0]) {
60 |
61 | UIView* uiStackScrollView = [[uiRightView subviews] objectAtIndex:0];
62 |
63 | if ([[uiStackScrollView subviews] objectAtIndex:1]) {
64 |
65 | UIView* uiSlideView = [[uiStackScrollView subviews] objectAtIndex:1];
66 |
67 | for (UIView* subView in [uiSlideView subviews]) {
68 | CGPoint point = [subView convertPoint:pt fromView:self];
69 | if ([subView pointInside:point withEvent:event]) {
70 | viewToReturn = subView;
71 | pointToReturn = point;
72 | }
73 |
74 | }
75 | }
76 |
77 | }
78 |
79 | if(viewToReturn != nil) {
80 | return [viewToReturn hitTest:pointToReturn withEvent:event];
81 | }
82 |
83 | return [super hitTest:pt withEvent:event];
84 |
85 | }
86 |
87 | @end
88 |
89 | @implementation RootViewController
90 | @synthesize menuViewController, stackScrollViewController;
91 |
92 | // The designated initializer. Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.
93 |
94 | - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
95 | self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
96 | if (self) {
97 | }
98 | return self;
99 | }
100 |
101 |
102 |
103 | // Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
104 | - (void)viewDidLoad {
105 | [super viewDidLoad];
106 | rootView = [[UIViewExt alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
107 | rootView.autoresizingMask = UIViewAutoresizingFlexibleWidth + UIViewAutoresizingFlexibleHeight;
108 | [rootView setBackgroundColor:[UIColor clearColor]];
109 |
110 | leftMenuView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 200, self.view.frame.size.height)];
111 | leftMenuView.autoresizingMask = UIViewAutoresizingFlexibleHeight;
112 | menuViewController = [[MenuViewController alloc] initWithFrame:CGRectMake(0, 0, leftMenuView.frame.size.width, leftMenuView.frame.size.height)];
113 | [menuViewController.view setBackgroundColor:[UIColor clearColor]];
114 | [menuViewController viewWillAppear:FALSE];
115 | [menuViewController viewDidAppear:FALSE];
116 | [leftMenuView addSubview:menuViewController.view];
117 |
118 | rightSlideView = [[UIView alloc] initWithFrame:CGRectMake(leftMenuView.frame.size.width, 0, rootView.frame.size.width - leftMenuView.frame.size.width, rootView.frame.size.height)];
119 | rightSlideView.autoresizingMask = UIViewAutoresizingFlexibleWidth + UIViewAutoresizingFlexibleHeight;
120 | stackScrollViewController = [[StackScrollViewController alloc] init];
121 | [stackScrollViewController.view setFrame:CGRectMake(0, 0, rightSlideView.frame.size.width, rightSlideView.frame.size.height)];
122 | [stackScrollViewController.view setAutoresizingMask:UIViewAutoresizingFlexibleWidth + UIViewAutoresizingFlexibleHeight];
123 | [stackScrollViewController viewWillAppear:FALSE];
124 | [stackScrollViewController viewDidAppear:FALSE];
125 | [rightSlideView addSubview:stackScrollViewController.view];
126 |
127 | [rootView addSubview:leftMenuView];
128 | [rootView addSubview:rightSlideView];
129 | [self.view setBackgroundColor:[UIColor colorWithPatternImage: [UIImage imageNamed:@"backgroundImage_repeat.png"]]];
130 | [self.view addSubview:rootView];
131 | }
132 |
133 |
134 |
135 | - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
136 | // Overriden to allow any orientation.
137 | return YES;
138 | }
139 |
140 | -(void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation {
141 | [menuViewController didRotateFromInterfaceOrientation:fromInterfaceOrientation];
142 | [stackScrollViewController didRotateFromInterfaceOrientation:fromInterfaceOrientation];
143 | }
144 |
145 | -(void) willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration{
146 | [menuViewController willAnimateRotationToInterfaceOrientation:toInterfaceOrientation duration:duration];
147 | [stackScrollViewController willAnimateRotationToInterfaceOrientation:toInterfaceOrientation duration:duration];
148 | }
149 | - (void)didReceiveMemoryWarning {
150 | [super didReceiveMemoryWarning];
151 | }
152 |
153 |
154 | - (void)viewDidUnload {
155 | [super viewDidUnload];
156 | }
157 |
158 |
159 | - (void)dealloc {
160 | [super dealloc];
161 | }
162 |
163 | @end
164 |
--------------------------------------------------------------------------------
/StackScrollView.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 1D3623260D0F684500981E51 /* StackScrollViewAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D3623250D0F684500981E51 /* StackScrollViewAppDelegate.m */; };
11 | 1D60589B0D05DD56006BFB54 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; };
12 | 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; };
13 | 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; };
14 | 2752544413790ADD005E9019 /* StackScrollViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2752544313790ADD005E9019 /* StackScrollViewController.m */; };
15 | 28AD733F0D9D9553002E5188 /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 28AD733E0D9D9553002E5188 /* MainWindow.xib */; };
16 | 312FC87F1380DA88003610C2 /* License in Resources */ = {isa = PBXBuildFile; fileRef = 312FC87E1380DA88003610C2 /* License */; };
17 | C12A8A50131776B500E7CA88 /* UIViewWithShadow.m in Sources */ = {isa = PBXBuildFile; fileRef = C12A8A4F131776B500E7CA88 /* UIViewWithShadow.m */; };
18 | C1842AEF1316641600D1538C /* RootViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C1842AEE1316641600D1538C /* RootViewController.m */; };
19 | C1842AF9131664DD00D1538C /* MenuViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C1842AF8131664DD00D1538C /* MenuViewController.m */; };
20 | C1842CED13168FE900D1538C /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C1842CEC13168FE900D1538C /* QuartzCore.framework */; };
21 | C1842D0D1316903C00D1538C /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C1842D0C1316903C00D1538C /* CoreGraphics.framework */; };
22 | C1842D8C131699CA00D1538C /* DataViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C1842D8B131699CA00D1538C /* DataViewController.m */; };
23 | C1D438971317D30A00D5EE69 /* backgroundImage_repeat.png in Resources */ = {isa = PBXBuildFile; fileRef = C1D438961317D30A00D5EE69 /* backgroundImage_repeat.png */; };
24 | /* End PBXBuildFile section */
25 |
26 | /* Begin PBXFileReference section */
27 | 1D30AB110D05D00D00671497 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
28 | 1D3623240D0F684500981E51 /* StackScrollViewAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StackScrollViewAppDelegate.h; sourceTree = ""; };
29 | 1D3623250D0F684500981E51 /* StackScrollViewAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = StackScrollViewAppDelegate.m; sourceTree = ""; };
30 | 1D6058910D05DD3D006BFB54 /* StackScrollView.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = StackScrollView.app; sourceTree = BUILT_PRODUCTS_DIR; };
31 | 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
32 | 2752544213790ADD005E9019 /* StackScrollViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StackScrollViewController.h; sourceTree = ""; };
33 | 2752544313790ADD005E9019 /* StackScrollViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = StackScrollViewController.m; sourceTree = ""; };
34 | 28AD733E0D9D9553002E5188 /* MainWindow.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MainWindow.xib; sourceTree = ""; };
35 | 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; };
36 | 312FC87E1380DA88003610C2 /* License */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = License; sourceTree = ""; };
37 | 32CA4F630368D1EE00C91783 /* StackScrollView_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StackScrollView_Prefix.pch; sourceTree = ""; };
38 | 8D1107310486CEB800E47090 /* StackScrollView-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "StackScrollView-Info.plist"; plistStructureDefinitionIdentifier = "com.apple.xcode.plist.structure-definition.iphone.info-plist"; sourceTree = ""; };
39 | C12A8A4E131776B500E7CA88 /* UIViewWithShadow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIViewWithShadow.h; sourceTree = ""; };
40 | C12A8A4F131776B500E7CA88 /* UIViewWithShadow.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIViewWithShadow.m; sourceTree = ""; };
41 | C1842AED1316641600D1538C /* RootViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RootViewController.h; sourceTree = ""; };
42 | C1842AEE1316641600D1538C /* RootViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RootViewController.m; sourceTree = ""; };
43 | C1842AF7131664DD00D1538C /* MenuViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MenuViewController.h; sourceTree = ""; };
44 | C1842AF8131664DD00D1538C /* MenuViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MenuViewController.m; sourceTree = ""; };
45 | C1842CEC13168FE900D1538C /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
46 | C1842D0C1316903C00D1538C /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
47 | C1842D8A131699CA00D1538C /* DataViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DataViewController.h; sourceTree = ""; };
48 | C1842D8B131699CA00D1538C /* DataViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DataViewController.m; sourceTree = ""; };
49 | C1D438961317D30A00D5EE69 /* backgroundImage_repeat.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = backgroundImage_repeat.png; sourceTree = ""; };
50 | /* End PBXFileReference section */
51 |
52 | /* Begin PBXFrameworksBuildPhase section */
53 | 1D60588F0D05DD3D006BFB54 /* Frameworks */ = {
54 | isa = PBXFrameworksBuildPhase;
55 | buildActionMask = 2147483647;
56 | files = (
57 | 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */,
58 | 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */,
59 | C1842CED13168FE900D1538C /* QuartzCore.framework in Frameworks */,
60 | C1842D0D1316903C00D1538C /* CoreGraphics.framework in Frameworks */,
61 | );
62 | runOnlyForDeploymentPostprocessing = 0;
63 | };
64 | /* End PBXFrameworksBuildPhase section */
65 |
66 | /* Begin PBXGroup section */
67 | 080E96DDFE201D6D7F000001 /* Classes */ = {
68 | isa = PBXGroup;
69 | children = (
70 | C12A8A4D1317769A00E7CA88 /* Extention */,
71 | 1D3623240D0F684500981E51 /* StackScrollViewAppDelegate.h */,
72 | 1D3623250D0F684500981E51 /* StackScrollViewAppDelegate.m */,
73 | C1842AED1316641600D1538C /* RootViewController.h */,
74 | C1842AEE1316641600D1538C /* RootViewController.m */,
75 | C1842AF7131664DD00D1538C /* MenuViewController.h */,
76 | C1842AF8131664DD00D1538C /* MenuViewController.m */,
77 | C1842D8A131699CA00D1538C /* DataViewController.h */,
78 | C1842D8B131699CA00D1538C /* DataViewController.m */,
79 | 2752544213790ADD005E9019 /* StackScrollViewController.h */,
80 | 2752544313790ADD005E9019 /* StackScrollViewController.m */,
81 | );
82 | path = Classes;
83 | sourceTree = "";
84 | };
85 | 19C28FACFE9D520D11CA2CBB /* Products */ = {
86 | isa = PBXGroup;
87 | children = (
88 | 1D6058910D05DD3D006BFB54 /* StackScrollView.app */,
89 | );
90 | name = Products;
91 | sourceTree = "";
92 | };
93 | 29B97314FDCFA39411CA2CEA /* CustomTemplate */ = {
94 | isa = PBXGroup;
95 | children = (
96 | 080E96DDFE201D6D7F000001 /* Classes */,
97 | 29B97315FDCFA39411CA2CEA /* Other Sources */,
98 | 29B97317FDCFA39411CA2CEA /* Resources */,
99 | 29B97323FDCFA39411CA2CEA /* Frameworks */,
100 | 19C28FACFE9D520D11CA2CBB /* Products */,
101 | 312FC87E1380DA88003610C2 /* License */,
102 | );
103 | name = CustomTemplate;
104 | sourceTree = "";
105 | };
106 | 29B97315FDCFA39411CA2CEA /* Other Sources */ = {
107 | isa = PBXGroup;
108 | children = (
109 | 32CA4F630368D1EE00C91783 /* StackScrollView_Prefix.pch */,
110 | 29B97316FDCFA39411CA2CEA /* main.m */,
111 | );
112 | name = "Other Sources";
113 | sourceTree = "";
114 | };
115 | 29B97317FDCFA39411CA2CEA /* Resources */ = {
116 | isa = PBXGroup;
117 | children = (
118 | C1D438961317D30A00D5EE69 /* backgroundImage_repeat.png */,
119 | 28AD733E0D9D9553002E5188 /* MainWindow.xib */,
120 | 8D1107310486CEB800E47090 /* StackScrollView-Info.plist */,
121 | );
122 | name = Resources;
123 | sourceTree = "";
124 | };
125 | 29B97323FDCFA39411CA2CEA /* Frameworks */ = {
126 | isa = PBXGroup;
127 | children = (
128 | 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */,
129 | 1D30AB110D05D00D00671497 /* Foundation.framework */,
130 | C1842CEC13168FE900D1538C /* QuartzCore.framework */,
131 | C1842D0C1316903C00D1538C /* CoreGraphics.framework */,
132 | );
133 | name = Frameworks;
134 | sourceTree = "";
135 | };
136 | C12A8A4D1317769A00E7CA88 /* Extention */ = {
137 | isa = PBXGroup;
138 | children = (
139 | C12A8A4E131776B500E7CA88 /* UIViewWithShadow.h */,
140 | C12A8A4F131776B500E7CA88 /* UIViewWithShadow.m */,
141 | );
142 | name = Extention;
143 | sourceTree = "";
144 | };
145 | /* End PBXGroup section */
146 |
147 | /* Begin PBXNativeTarget section */
148 | 1D6058900D05DD3D006BFB54 /* StackScrollView */ = {
149 | isa = PBXNativeTarget;
150 | buildConfigurationList = 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "StackScrollView" */;
151 | buildPhases = (
152 | 1D60588D0D05DD3D006BFB54 /* Resources */,
153 | 1D60588E0D05DD3D006BFB54 /* Sources */,
154 | 1D60588F0D05DD3D006BFB54 /* Frameworks */,
155 | );
156 | buildRules = (
157 | );
158 | dependencies = (
159 | );
160 | name = StackScrollView;
161 | productName = SlidingView;
162 | productReference = 1D6058910D05DD3D006BFB54 /* StackScrollView.app */;
163 | productType = "com.apple.product-type.application";
164 | };
165 | /* End PBXNativeTarget section */
166 |
167 | /* Begin PBXProject section */
168 | 29B97313FDCFA39411CA2CEA /* Project object */ = {
169 | isa = PBXProject;
170 | attributes = {
171 | LastUpgradeCheck = 0410;
172 | };
173 | buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "StackScrollView" */;
174 | compatibilityVersion = "Xcode 3.2";
175 | developmentRegion = English;
176 | hasScannedForEncodings = 1;
177 | knownRegions = (
178 | English,
179 | Japanese,
180 | French,
181 | German,
182 | );
183 | mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */;
184 | projectDirPath = "";
185 | projectRoot = "";
186 | targets = (
187 | 1D6058900D05DD3D006BFB54 /* StackScrollView */,
188 | );
189 | };
190 | /* End PBXProject section */
191 |
192 | /* Begin PBXResourcesBuildPhase section */
193 | 1D60588D0D05DD3D006BFB54 /* Resources */ = {
194 | isa = PBXResourcesBuildPhase;
195 | buildActionMask = 2147483647;
196 | files = (
197 | 28AD733F0D9D9553002E5188 /* MainWindow.xib in Resources */,
198 | C1D438971317D30A00D5EE69 /* backgroundImage_repeat.png in Resources */,
199 | 312FC87F1380DA88003610C2 /* License in Resources */,
200 | );
201 | runOnlyForDeploymentPostprocessing = 0;
202 | };
203 | /* End PBXResourcesBuildPhase section */
204 |
205 | /* Begin PBXSourcesBuildPhase section */
206 | 1D60588E0D05DD3D006BFB54 /* Sources */ = {
207 | isa = PBXSourcesBuildPhase;
208 | buildActionMask = 2147483647;
209 | files = (
210 | 1D60589B0D05DD56006BFB54 /* main.m in Sources */,
211 | 1D3623260D0F684500981E51 /* StackScrollViewAppDelegate.m in Sources */,
212 | C1842AEF1316641600D1538C /* RootViewController.m in Sources */,
213 | C1842AF9131664DD00D1538C /* MenuViewController.m in Sources */,
214 | C1842D8C131699CA00D1538C /* DataViewController.m in Sources */,
215 | C12A8A50131776B500E7CA88 /* UIViewWithShadow.m in Sources */,
216 | 2752544413790ADD005E9019 /* StackScrollViewController.m in Sources */,
217 | );
218 | runOnlyForDeploymentPostprocessing = 0;
219 | };
220 | /* End PBXSourcesBuildPhase section */
221 |
222 | /* Begin XCBuildConfiguration section */
223 | 1D6058940D05DD3E006BFB54 /* Debug */ = {
224 | isa = XCBuildConfiguration;
225 | buildSettings = {
226 | ALWAYS_SEARCH_USER_PATHS = NO;
227 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "Don't Code Sign";
228 | COPY_PHASE_STRIP = NO;
229 | GCC_DYNAMIC_NO_PIC = NO;
230 | GCC_OPTIMIZATION_LEVEL = 0;
231 | GCC_PRECOMPILE_PREFIX_HEADER = YES;
232 | GCC_PREFIX_HEADER = StackScrollView_Prefix.pch;
233 | GCC_VERSION = com.apple.compilers.llvmgcc42;
234 | INFOPLIST_FILE = "StackScrollView-Info.plist";
235 | IPHONEOS_DEPLOYMENT_TARGET = 3.2;
236 | PRODUCT_NAME = StackScrollView;
237 | "PROVISIONING_PROFILE[sdk=iphoneos*]" = "";
238 | };
239 | name = Debug;
240 | };
241 | 1D6058950D05DD3E006BFB54 /* Release */ = {
242 | isa = XCBuildConfiguration;
243 | buildSettings = {
244 | ALWAYS_SEARCH_USER_PATHS = NO;
245 | COPY_PHASE_STRIP = YES;
246 | GCC_PRECOMPILE_PREFIX_HEADER = YES;
247 | GCC_PREFIX_HEADER = StackScrollView_Prefix.pch;
248 | GCC_VERSION = com.apple.compilers.llvmgcc42;
249 | INFOPLIST_FILE = "StackScrollView-Info.plist";
250 | IPHONEOS_DEPLOYMENT_TARGET = 3.2;
251 | PRODUCT_NAME = StackScrollView;
252 | VALIDATE_PRODUCT = YES;
253 | };
254 | name = Release;
255 | };
256 | C01FCF4F08A954540054247B /* Debug */ = {
257 | isa = XCBuildConfiguration;
258 | buildSettings = {
259 | ARCHS = "$(ARCHS_UNIVERSAL_IPHONE_OS)";
260 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "Don't Code Sign";
261 | GCC_C_LANGUAGE_STANDARD = c99;
262 | GCC_WARN_ABOUT_RETURN_TYPE = YES;
263 | GCC_WARN_UNUSED_VARIABLE = YES;
264 | IPHONEOS_DEPLOYMENT_TARGET = 3.2;
265 | "PROVISIONING_PROFILE[sdk=iphoneos*]" = "";
266 | SDKROOT = iphoneos;
267 | TARGETED_DEVICE_FAMILY = 2;
268 | };
269 | name = Debug;
270 | };
271 | C01FCF5008A954540054247B /* Release */ = {
272 | isa = XCBuildConfiguration;
273 | buildSettings = {
274 | ARCHS = "$(ARCHS_UNIVERSAL_IPHONE_OS)";
275 | CODE_SIGN_IDENTITY = "Don't Code Sign";
276 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "Don't Code Sign";
277 | GCC_C_LANGUAGE_STANDARD = c99;
278 | GCC_WARN_ABOUT_RETURN_TYPE = YES;
279 | GCC_WARN_UNUSED_VARIABLE = YES;
280 | IPHONEOS_DEPLOYMENT_TARGET = 3.2;
281 | OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
282 | PROVISIONING_PROFILE = "";
283 | "PROVISIONING_PROFILE[sdk=iphoneos*]" = "";
284 | SDKROOT = iphoneos;
285 | TARGETED_DEVICE_FAMILY = 2;
286 | };
287 | name = Release;
288 | };
289 | /* End XCBuildConfiguration section */
290 |
291 | /* Begin XCConfigurationList section */
292 | 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "StackScrollView" */ = {
293 | isa = XCConfigurationList;
294 | buildConfigurations = (
295 | 1D6058940D05DD3E006BFB54 /* Debug */,
296 | 1D6058950D05DD3E006BFB54 /* Release */,
297 | );
298 | defaultConfigurationIsVisible = 0;
299 | defaultConfigurationName = Release;
300 | };
301 | C01FCF4E08A954540054247B /* Build configuration list for PBXProject "StackScrollView" */ = {
302 | isa = XCConfigurationList;
303 | buildConfigurations = (
304 | C01FCF4F08A954540054247B /* Debug */,
305 | C01FCF5008A954540054247B /* Release */,
306 | );
307 | defaultConfigurationIsVisible = 0;
308 | defaultConfigurationName = Release;
309 | };
310 | /* End XCConfigurationList section */
311 | };
312 | rootObject = 29B97313FDCFA39411CA2CEA /* Project object */;
313 | }
314 |
--------------------------------------------------------------------------------
/MainWindow.xib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 1056
5 | 10J869
6 | 823
7 | 1038.35
8 | 461.00
9 |
13 |
16 |
20 |
29 |
30 | YES
31 |
32 | IBFilesOwner
33 | IBIPadFramework
34 |
35 |
36 | IBFirstResponder
37 | IBIPadFramework
38 |
39 |
40 |
41 | 292
42 | {768, 1024}
43 |
44 | 1
45 | MSAxIDEAA
46 |
47 | NO
48 | NO
49 |
50 | 2
51 |
52 | IBIPadFramework
53 | YES
54 |
55 |
56 | IBIPadFramework
57 |
58 |
59 |
60 |
61 | YES
62 |
63 |
64 | delegate
65 |
66 |
67 |
68 | 9
69 |
70 |
71 |
72 | window
73 |
74 |
75 |
76 | 10
77 |
78 |
79 |
80 |
81 | YES
82 |
83 | 0
84 |
85 |
86 |
87 |
88 |
89 | -1
90 |
91 |
92 | File's Owner
93 |
94 |
95 | -2
96 |
97 |
98 |
99 |
100 | 2
101 |
102 |
103 |
104 |
105 | 6
106 |
107 |
108 | SlidingView App Delegate
109 |
110 |
111 |
112 |
113 | YES
114 |
115 | YES
116 | -1.CustomClassName
117 | -2.CustomClassName
118 | 2.IBEditorWindowLastContentRect
119 | 2.IBPluginDependency
120 | 6.CustomClassName
121 | 6.IBPluginDependency
122 |
123 |
124 | YES
125 | UIApplication
126 | UIResponder
127 | {{200, 0}, {783, 856}}
128 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin
129 | StackScrollViewAppDelegate
130 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin
131 |
132 |
133 |
134 | YES
135 |
136 |
137 | YES
138 |
139 |
140 |
141 |
142 | YES
143 |
144 |
145 | YES
146 |
147 |
148 |
149 | 10
150 |
151 |
152 |
153 | YES
154 |
155 | RootViewController
156 | UIViewController
157 |
158 | IBProjectSource
159 | Classes/RootViewController.h
160 |
161 |
162 |
163 | StackScrollViewAppDelegate
164 | NSObject
165 |
166 | YES
167 |
168 | YES
169 | rootViewController
170 | window
171 |
172 |
173 | YES
174 | RootViewController
175 | UIWindow
176 |
177 |
178 |
179 | YES
180 |
181 | YES
182 | rootViewController
183 | window
184 |
185 |
186 | YES
187 |
188 | rootViewController
189 | RootViewController
190 |
191 |
192 | window
193 | UIWindow
194 |
195 |
196 |
197 |
198 | IBUserSource
199 |
200 |
201 |
202 |
203 |
204 | YES
205 |
206 | NSObject
207 |
208 | IBFrameworkSource
209 | Foundation.framework/Headers/NSError.h
210 |
211 |
212 |
213 | NSObject
214 |
215 | IBFrameworkSource
216 | Foundation.framework/Headers/NSFileManager.h
217 |
218 |
219 |
220 | NSObject
221 |
222 | IBFrameworkSource
223 | Foundation.framework/Headers/NSKeyValueCoding.h
224 |
225 |
226 |
227 | NSObject
228 |
229 | IBFrameworkSource
230 | Foundation.framework/Headers/NSKeyValueObserving.h
231 |
232 |
233 |
234 | NSObject
235 |
236 | IBFrameworkSource
237 | Foundation.framework/Headers/NSKeyedArchiver.h
238 |
239 |
240 |
241 | NSObject
242 |
243 | IBFrameworkSource
244 | Foundation.framework/Headers/NSObject.h
245 |
246 |
247 |
248 | NSObject
249 |
250 | IBFrameworkSource
251 | Foundation.framework/Headers/NSRunLoop.h
252 |
253 |
254 |
255 | NSObject
256 |
257 | IBFrameworkSource
258 | Foundation.framework/Headers/NSThread.h
259 |
260 |
261 |
262 | NSObject
263 |
264 | IBFrameworkSource
265 | Foundation.framework/Headers/NSURL.h
266 |
267 |
268 |
269 | NSObject
270 |
271 | IBFrameworkSource
272 | Foundation.framework/Headers/NSURLConnection.h
273 |
274 |
275 |
276 | NSObject
277 |
278 | IBFrameworkSource
279 | QuartzCore.framework/Headers/CAAnimation.h
280 |
281 |
282 |
283 | NSObject
284 |
285 | IBFrameworkSource
286 | QuartzCore.framework/Headers/CALayer.h
287 |
288 |
289 |
290 | NSObject
291 |
292 | IBFrameworkSource
293 | UIKit.framework/Headers/UIAccessibility.h
294 |
295 |
296 |
297 | NSObject
298 |
299 | IBFrameworkSource
300 | UIKit.framework/Headers/UINibLoading.h
301 |
302 |
303 |
304 | NSObject
305 |
306 | IBFrameworkSource
307 | UIKit.framework/Headers/UIResponder.h
308 |
309 |
310 |
311 | UIApplication
312 | UIResponder
313 |
314 | IBFrameworkSource
315 | UIKit.framework/Headers/UIApplication.h
316 |
317 |
318 |
319 | UIResponder
320 | NSObject
321 |
322 |
323 |
324 | UISearchBar
325 | UIView
326 |
327 | IBFrameworkSource
328 | UIKit.framework/Headers/UISearchBar.h
329 |
330 |
331 |
332 | UISearchDisplayController
333 | NSObject
334 |
335 | IBFrameworkSource
336 | UIKit.framework/Headers/UISearchDisplayController.h
337 |
338 |
339 |
340 | UIView
341 |
342 | IBFrameworkSource
343 | UIKit.framework/Headers/UIPrintFormatter.h
344 |
345 |
346 |
347 | UIView
348 |
349 | IBFrameworkSource
350 | UIKit.framework/Headers/UITextField.h
351 |
352 |
353 |
354 | UIView
355 | UIResponder
356 |
357 | IBFrameworkSource
358 | UIKit.framework/Headers/UIView.h
359 |
360 |
361 |
362 | UIViewController
363 |
364 | IBFrameworkSource
365 | UIKit.framework/Headers/UINavigationController.h
366 |
367 |
368 |
369 | UIViewController
370 |
371 | IBFrameworkSource
372 | UIKit.framework/Headers/UIPopoverController.h
373 |
374 |
375 |
376 | UIViewController
377 |
378 | IBFrameworkSource
379 | UIKit.framework/Headers/UISplitViewController.h
380 |
381 |
382 |
383 | UIViewController
384 |
385 | IBFrameworkSource
386 | UIKit.framework/Headers/UITabBarController.h
387 |
388 |
389 |
390 | UIViewController
391 | UIResponder
392 |
393 | IBFrameworkSource
394 | UIKit.framework/Headers/UIViewController.h
395 |
396 |
397 |
398 | UIWindow
399 | UIView
400 |
401 | IBFrameworkSource
402 | UIKit.framework/Headers/UIWindow.h
403 |
404 |
405 |
406 |
407 | 0
408 | IBIPadFramework
409 |
410 | com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS
411 |
412 |
413 |
414 | com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3
415 |
416 |
417 | YES
418 | SlidingView.xcodeproj
419 | 3
420 | 132
421 |
422 |
423 |
--------------------------------------------------------------------------------
/Classes/StackScrollViewController.m:
--------------------------------------------------------------------------------
1 | /*
2 | This module is licenced under the BSD license.
3 |
4 | Copyright (C) 2011 by raw engineering .
5 |
6 | All rights reserved.
7 |
8 | Redistribution and use in source and binary forms, with or without
9 | modification, are permitted provided that the following conditions
10 | are met:
11 |
12 | * Redistributions of source code must retain the above copyright
13 | notice, this list of conditions and the following disclaimer.
14 |
15 | * Redistributions in binary form must reproduce the above copyright
16 | notice, this list of conditions and the following disclaimer in the
17 | documentation and/or other materials provided with the distribution.
18 |
19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 | HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
25 | TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 | */
31 | //
32 | // StackScrollViewController.m
33 | // SlidingView
34 | //
35 | // Created by Reefaq on 2/24/11.
36 | // Copyright 2011 raw engineering . All rights reserved.
37 | //
38 |
39 | #import "StackScrollViewController.h"
40 | #import "UIViewWithShadow.h";
41 |
42 | const NSInteger SLIDE_VIEWS_MINUS_X_POSITION = -130;
43 | const NSInteger SLIDE_VIEWS_START_X_POS = 0;
44 |
45 | @implementation StackScrollViewController
46 |
47 | @synthesize slideViews, borderViews, viewControllersStack, slideStartPosition;
48 |
49 | -(id)init {
50 |
51 | if(self= [super init]) {
52 |
53 | viewControllersStack = [[NSMutableArray alloc] init];
54 | borderViews = [[UIView alloc] initWithFrame:CGRectMake(SLIDE_VIEWS_MINUS_X_POSITION - 2, -2, 2, self.view.frame.size.height)];
55 | [borderViews setBackgroundColor:[UIColor clearColor]];
56 | UIView* verticalLineView1 = [[[UIView alloc] initWithFrame:CGRectMake(0, 0, 1, borderViews.frame.size.height)] autorelease];
57 | [verticalLineView1 setBackgroundColor:[UIColor whiteColor]];
58 | [verticalLineView1 setTag:1];
59 | [verticalLineView1 setHidden:TRUE];
60 | [borderViews addSubview:verticalLineView1];
61 |
62 | UIView* verticalLineView2 = [[[UIView alloc] initWithFrame:CGRectMake(0, 0, 2, borderViews.frame.size.height)] autorelease];
63 | [verticalLineView2 setBackgroundColor:[UIColor grayColor]];
64 | [verticalLineView2 setTag:2];
65 | [verticalLineView2 setHidden:TRUE];
66 | [borderViews addSubview:verticalLineView2];
67 |
68 | [self.view addSubview:borderViews];
69 |
70 | slideViews = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
71 | [slideViews setBackgroundColor:[UIColor clearColor]];
72 | [self.view setBackgroundColor:[UIColor clearColor]];
73 | [self.view setFrame:slideViews.frame];
74 | self.view.autoresizingMask = UIViewAutoresizingFlexibleHeight;
75 | viewXPosition = 0;
76 | lastTouchPoint = -1;
77 |
78 | dragDirection = [[NSString alloc] init];
79 | dragDirection = @"";
80 |
81 | viewAtLeft2=nil;
82 | viewAtLeft=nil;
83 | viewAtRight=nil;
84 | viewAtRight2=nil;
85 | viewAtRightAtTouchBegan = nil;
86 |
87 | UIPanGestureRecognizer* panRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handlePanFrom:)];
88 | [panRecognizer setMaximumNumberOfTouches:1];
89 | [panRecognizer setDelaysTouchesBegan:TRUE];
90 | [panRecognizer setDelaysTouchesEnded:TRUE];
91 | [panRecognizer setCancelsTouchesInView:TRUE];
92 | [self.view addGestureRecognizer:panRecognizer];
93 | [panRecognizer release];
94 |
95 | [self.view addSubview:slideViews];
96 |
97 | }
98 |
99 | return self;
100 | }
101 |
102 | -(void)arrangeVerticalBar {
103 |
104 | if ([[slideViews subviews] count] > 2) {
105 | [[borderViews viewWithTag:2] setHidden:TRUE];
106 | [[borderViews viewWithTag:1] setHidden:TRUE];
107 | NSInteger stackCount = 0;
108 | if (viewAtLeft != nil ) {
109 | stackCount = [[slideViews subviews] indexOfObject:viewAtLeft];
110 | }
111 |
112 | if (viewAtLeft != nil && viewAtLeft.frame.origin.x == SLIDE_VIEWS_MINUS_X_POSITION) {
113 | stackCount += 1;
114 | }
115 |
116 | if (stackCount == 2) {
117 | [[borderViews viewWithTag:2] setHidden:FALSE];
118 | }
119 | if (stackCount >= 3) {
120 | [[borderViews viewWithTag:2] setHidden:FALSE];
121 | [[borderViews viewWithTag:1] setHidden:FALSE];
122 | }
123 |
124 |
125 | }
126 | }
127 |
128 |
129 | - (void)handlePanFrom:(UIPanGestureRecognizer *)recognizer {
130 |
131 | CGPoint translatedPoint = [recognizer translationInView:self.view];
132 |
133 | if (recognizer.state == UIGestureRecognizerStateBegan) {
134 | displacementPosition = 0;
135 | positionOfViewAtRightAtTouchBegan = viewAtRight.frame.origin;
136 | positionOfViewAtLeftAtTouchBegan = viewAtLeft.frame.origin;
137 | viewAtRightAtTouchBegan = viewAtRight;
138 | viewAtLeftAtTouchBegan = viewAtLeft;
139 | [viewAtLeft.layer removeAllAnimations];
140 | [viewAtRight.layer removeAllAnimations];
141 | [viewAtRight2.layer removeAllAnimations];
142 | [viewAtLeft2.layer removeAllAnimations];
143 | if (viewAtLeft2 != nil) {
144 | NSInteger viewAtLeft2Position = [[slideViews subviews] indexOfObject:viewAtLeft2];
145 | if (viewAtLeft2Position > 0) {
146 | [((UIView*)[[slideViews subviews] objectAtIndex:viewAtLeft2Position -1]) setHidden:FALSE];
147 | }
148 | }
149 |
150 | [self arrangeVerticalBar];
151 | }
152 |
153 |
154 | CGPoint location = [recognizer locationInView:self.view];
155 |
156 | if (lastTouchPoint != -1) {
157 |
158 | if (location.x < lastTouchPoint) {
159 |
160 | if ([dragDirection isEqualToString:@"RIGHT"]) {
161 | positionOfViewAtRightAtTouchBegan = viewAtRight.frame.origin;
162 | positionOfViewAtLeftAtTouchBegan = viewAtLeft.frame.origin;
163 | displacementPosition = translatedPoint.x * -1;
164 | }
165 |
166 | dragDirection = @"LEFT";
167 |
168 | if (viewAtRight != nil) {
169 |
170 | if (viewAtLeft.frame.origin.x <= SLIDE_VIEWS_MINUS_X_POSITION) {
171 | if ([[slideViews subviews] indexOfObject:viewAtRight] < ([[slideViews subviews] count]-1)) {
172 | viewAtLeft2 = viewAtLeft;
173 | viewAtLeft = viewAtRight;
174 | [viewAtRight2 setHidden:FALSE];
175 | viewAtRight = viewAtRight2;
176 | if ([[slideViews subviews] indexOfObject:viewAtRight] < ([[slideViews subviews] count]-1)) {
177 | viewAtRight2 = [[slideViews subviews] objectAtIndex:[[slideViews subviews] indexOfObject:viewAtRight] + 1];
178 | }else {
179 | viewAtRight2 = nil;
180 | }
181 | positionOfViewAtRightAtTouchBegan = viewAtRight.frame.origin;
182 | positionOfViewAtLeftAtTouchBegan = viewAtLeft.frame.origin;
183 | displacementPosition = translatedPoint.x * -1;
184 | if ([[slideViews subviews] indexOfObject:viewAtLeft2] > 1) {
185 | [[[slideViews subviews] objectAtIndex:[[slideViews subviews] indexOfObject:viewAtLeft2] - 2] setHidden:TRUE];
186 | }
187 |
188 | }
189 |
190 | }
191 |
192 | if (viewAtLeft.frame.origin.x == SLIDE_VIEWS_MINUS_X_POSITION && viewAtRight.frame.origin.x + viewAtRight.frame.size.width > self.view.frame.size.width) {
193 | if ((positionOfViewAtRightAtTouchBegan.x + translatedPoint.x + displacementPosition + viewAtRight.frame.size.width) <= self.view.frame.size.width) {
194 | [viewAtRight setFrame:CGRectMake(self.view.frame.size.width - viewAtRight.frame.size.width, viewAtRight.frame.origin.y, viewAtRight.frame.size.width, viewAtRight.frame.size.height)];
195 | }else {
196 | [viewAtRight setFrame:CGRectMake(positionOfViewAtRightAtTouchBegan.x + translatedPoint.x + displacementPosition, viewAtRight.frame.origin.y, viewAtRight.frame.size.width, viewAtRight.frame.size.height)];
197 | }
198 |
199 | }
200 | else if (([[slideViews subviews] indexOfObject:viewAtRight] == [[slideViews subviews] count]-1) && viewAtRight.frame.origin.x <= (self.view.frame.size.width - viewAtRight.frame.size.width)) {
201 | if ((positionOfViewAtRightAtTouchBegan.x + translatedPoint.x + displacementPosition) <= SLIDE_VIEWS_MINUS_X_POSITION) {
202 | [viewAtRight setFrame:CGRectMake(SLIDE_VIEWS_MINUS_X_POSITION, viewAtRight.frame.origin.y, viewAtRight.frame.size.width, viewAtRight.frame.size.height)];
203 | }else {
204 | [viewAtRight setFrame:CGRectMake(positionOfViewAtRightAtTouchBegan.x + translatedPoint.x + displacementPosition, viewAtRight.frame.origin.y, viewAtRight.frame.size.width, viewAtRight.frame.size.height)];
205 | }
206 | }
207 | else{
208 | if (positionOfViewAtLeftAtTouchBegan.x + translatedPoint.x + displacementPosition <= SLIDE_VIEWS_MINUS_X_POSITION) {
209 | [viewAtLeft setFrame:CGRectMake(SLIDE_VIEWS_MINUS_X_POSITION, viewAtLeft.frame.origin.y, viewAtLeft.frame.size.width, viewAtLeft.frame.size.height)];
210 | }else {
211 | [viewAtLeft setFrame:CGRectMake(positionOfViewAtLeftAtTouchBegan.x + translatedPoint.x + displacementPosition , viewAtLeft.frame.origin.y, viewAtLeft.frame.size.width, viewAtLeft.frame.size.height)];
212 | }
213 | [viewAtRight setFrame:CGRectMake(viewAtLeft.frame.origin.x + viewAtLeft.frame.size.width, viewAtRight.frame.origin.y, viewAtRight.frame.size.width, viewAtRight.frame.size.height)];
214 |
215 | if (viewAtLeft.frame.origin.x == SLIDE_VIEWS_MINUS_X_POSITION) {
216 | positionOfViewAtRightAtTouchBegan = viewAtRight.frame.origin;
217 | positionOfViewAtLeftAtTouchBegan = viewAtLeft.frame.origin;
218 | displacementPosition = translatedPoint.x * -1;
219 | }
220 |
221 | }
222 |
223 | }else {
224 | [viewAtLeft setFrame:CGRectMake(positionOfViewAtLeftAtTouchBegan.x + translatedPoint.x + displacementPosition , viewAtLeft.frame.origin.y, viewAtLeft.frame.size.width, viewAtLeft.frame.size.height)];
225 | }
226 |
227 | [self arrangeVerticalBar];
228 |
229 | }else if (location.x > lastTouchPoint) {
230 |
231 | if ([dragDirection isEqualToString:@"LEFT"]) {
232 | positionOfViewAtRightAtTouchBegan = viewAtRight.frame.origin;
233 | positionOfViewAtLeftAtTouchBegan = viewAtLeft.frame.origin;
234 | displacementPosition = translatedPoint.x;
235 | }
236 |
237 | dragDirection = @"RIGHT";
238 |
239 | if (viewAtLeft != nil) {
240 |
241 | if (viewAtRight.frame.origin.x >= self.view.frame.size.width) {
242 |
243 | if ([[slideViews subviews] indexOfObject:viewAtLeft] > 0) {
244 | [viewAtRight2 setHidden:TRUE];
245 | viewAtRight2 = viewAtRight;
246 | viewAtRight = viewAtLeft;
247 | viewAtLeft = viewAtLeft2;
248 | if ([[slideViews subviews] indexOfObject:viewAtLeft] > 0) {
249 | viewAtLeft2 = [[slideViews subviews] objectAtIndex:[[slideViews subviews] indexOfObject:viewAtLeft] - 1];
250 | [viewAtLeft2 setHidden:FALSE];
251 | }
252 | else{
253 | viewAtLeft2 = nil;
254 | }
255 | positionOfViewAtRightAtTouchBegan = viewAtRight.frame.origin;
256 | positionOfViewAtLeftAtTouchBegan = viewAtLeft.frame.origin;
257 | displacementPosition = translatedPoint.x;
258 |
259 | [self arrangeVerticalBar];
260 | }
261 | }
262 |
263 | if((viewAtRight.frame.origin.x < (viewAtLeft.frame.origin.x + viewAtLeft.frame.size.width)) && viewAtLeft.frame.origin.x == SLIDE_VIEWS_MINUS_X_POSITION){
264 | if ((positionOfViewAtRightAtTouchBegan.x + translatedPoint.x - displacementPosition) >= (viewAtLeft.frame.origin.x + viewAtLeft.frame.size.width)) {
265 | [viewAtRight setFrame:CGRectMake(viewAtLeft.frame.origin.x + viewAtLeft.frame.size.width, viewAtRight.frame.origin.y, viewAtRight.frame.size.width, viewAtRight.frame.size.height)];
266 | }else {
267 | [viewAtRight setFrame:CGRectMake(positionOfViewAtRightAtTouchBegan.x + translatedPoint.x - displacementPosition, viewAtRight.frame.origin.y, viewAtRight.frame.size.width, viewAtRight.frame.size.height)];
268 | }
269 |
270 | }
271 | else if ([[slideViews subviews] indexOfObject:viewAtLeft] == 0) {
272 | if (viewAtRight == nil) {
273 | [viewAtLeft setFrame:CGRectMake(positionOfViewAtLeftAtTouchBegan.x + translatedPoint.x - displacementPosition, viewAtLeft.frame.origin.y, viewAtLeft.frame.size.width, viewAtLeft.frame.size.height)];
274 | }
275 | else{
276 | [viewAtRight setFrame:CGRectMake(positionOfViewAtRightAtTouchBegan.x + translatedPoint.x - displacementPosition, viewAtRight.frame.origin.y, viewAtRight.frame.size.width, viewAtRight.frame.size.height)];
277 | if (viewAtRight.frame.origin.x - viewAtLeft.frame.size.width < SLIDE_VIEWS_MINUS_X_POSITION) {
278 | [viewAtLeft setFrame:CGRectMake(SLIDE_VIEWS_MINUS_X_POSITION, viewAtLeft.frame.origin.y, viewAtLeft.frame.size.width, viewAtLeft.frame.size.height)];
279 | }else{
280 | [viewAtLeft setFrame:CGRectMake(viewAtRight.frame.origin.x - viewAtLeft.frame.size.width, viewAtLeft.frame.origin.y, viewAtLeft.frame.size.width, viewAtLeft.frame.size.height)];
281 | }
282 | }
283 | }
284 | else{
285 | if ((positionOfViewAtRightAtTouchBegan.x + translatedPoint.x - displacementPosition) >= self.view.frame.size.width) {
286 | [viewAtRight setFrame:CGRectMake(self.view.frame.size.width, viewAtRight.frame.origin.y, viewAtRight.frame.size.width, viewAtRight.frame.size.height)];
287 | }else {
288 | [viewAtRight setFrame:CGRectMake(positionOfViewAtRightAtTouchBegan.x + translatedPoint.x - displacementPosition, viewAtRight.frame.origin.y, viewAtRight.frame.size.width, viewAtRight.frame.size.height)];
289 | }
290 | if (viewAtRight.frame.origin.x - viewAtLeft.frame.size.width < SLIDE_VIEWS_MINUS_X_POSITION) {
291 | [viewAtLeft setFrame:CGRectMake(SLIDE_VIEWS_MINUS_X_POSITION, viewAtLeft.frame.origin.y, viewAtLeft.frame.size.width, viewAtLeft.frame.size.height)];
292 | }
293 | else{
294 | [viewAtLeft setFrame:CGRectMake(viewAtRight.frame.origin.x - viewAtLeft.frame.size.width, viewAtLeft.frame.origin.y, viewAtLeft.frame.size.width, viewAtLeft.frame.size.height)];
295 | }
296 | if (viewAtRight.frame.origin.x >= self.view.frame.size.width) {
297 | positionOfViewAtRightAtTouchBegan = viewAtRight.frame.origin;
298 | positionOfViewAtLeftAtTouchBegan = viewAtLeft.frame.origin;
299 | displacementPosition = translatedPoint.x;
300 | }
301 |
302 | [self arrangeVerticalBar];
303 | }
304 |
305 | }
306 |
307 | [self arrangeVerticalBar];
308 | }
309 | }
310 |
311 | lastTouchPoint = location.x;
312 |
313 | // STATE END
314 | if (recognizer.state == UIGestureRecognizerStateEnded) {
315 |
316 | if ([dragDirection isEqualToString:@"LEFT"]) {
317 | if (viewAtRight != nil) {
318 | if ([[slideViews subviews] indexOfObject:viewAtLeft] == 0 && !(viewAtLeft.frame.origin.x == SLIDE_VIEWS_MINUS_X_POSITION || viewAtLeft.frame.origin.x == SLIDE_VIEWS_START_X_POS)) {
319 | [UIView beginAnimations:nil context:NULL];
320 | [UIView setAnimationDuration:0.2];
321 | [UIView setAnimationTransition:UIViewAnimationTransitionNone forView:nil cache:YES];
322 | [UIView setAnimationBeginsFromCurrentState:YES];
323 | if (viewAtLeft.frame.origin.x < SLIDE_VIEWS_START_X_POS && viewAtRight != nil) {
324 | [viewAtLeft setFrame:CGRectMake(SLIDE_VIEWS_MINUS_X_POSITION, viewAtLeft.frame.origin.y, viewAtLeft.frame.size.width, viewAtLeft.frame.size.height)];
325 | [viewAtRight setFrame:CGRectMake(SLIDE_VIEWS_MINUS_X_POSITION + viewAtLeft.frame.size.width, viewAtRight.frame.origin.y, viewAtRight.frame.size.width,viewAtRight.frame.size.height)];
326 | }
327 | else{
328 |
329 | //Drop Card View Animation
330 | if ((((UIView*)[[slideViews subviews] objectAtIndex:0]).frame.origin.x+200) >= (self.view.frame.origin.x + ((UIView*)[[slideViews subviews] objectAtIndex:0]).frame.size.width)) {
331 |
332 | NSInteger viewControllerCount = [viewControllersStack count];
333 |
334 | if (viewControllerCount > 1) {
335 | for (int i = 1; i < viewControllerCount; i++) {
336 | viewXPosition = self.view.frame.size.width - [slideViews viewWithTag:i].frame.size.width;
337 | [[slideViews viewWithTag:i] removeFromSuperview];
338 | [viewControllersStack removeLastObject];
339 | }
340 |
341 | [[borderViews viewWithTag:3] setHidden:TRUE];
342 | [[borderViews viewWithTag:2] setHidden:TRUE];
343 | [[borderViews viewWithTag:1] setHidden:TRUE];
344 |
345 | }
346 |
347 | // Removes the selection of row for the first slide view
348 | for (UIView* tableView in [[[slideViews subviews] objectAtIndex:0] subviews]) {
349 | if([tableView isKindOfClass:[UITableView class]]){
350 | NSIndexPath* selectedRow = [(UITableView*)tableView indexPathForSelectedRow];
351 | NSArray *indexPaths = [NSArray arrayWithObjects:selectedRow, nil];
352 | [(UITableView*)tableView reloadRowsAtIndexPaths:indexPaths withRowAnimation:NO];
353 | }
354 | }
355 | viewAtLeft2 = nil;
356 | viewAtRight = nil;
357 | viewAtRight2 = nil;
358 | }
359 |
360 | [viewAtLeft setFrame:CGRectMake(SLIDE_VIEWS_START_X_POS, viewAtLeft.frame.origin.y, viewAtLeft.frame.size.width, viewAtLeft.frame.size.height)];
361 | if (viewAtRight != nil) {
362 | [viewAtRight setFrame:CGRectMake(SLIDE_VIEWS_START_X_POS + viewAtLeft.frame.size.width, viewAtRight.frame.origin.y, viewAtRight.frame.size.width,viewAtRight.frame.size.height)];
363 | }
364 |
365 | }
366 | [UIView commitAnimations];
367 | }
368 | else if (viewAtLeft.frame.origin.x == SLIDE_VIEWS_MINUS_X_POSITION && viewAtRight.frame.origin.x + viewAtRight.frame.size.width > self.view.frame.size.width) {
369 | [UIView beginAnimations:nil context:NULL];
370 | [UIView setAnimationDuration:0.2];
371 | [UIView setAnimationTransition:UIViewAnimationTransitionNone forView:nil cache:YES];
372 | [UIView setAnimationBeginsFromCurrentState:YES];
373 | [viewAtRight setFrame:CGRectMake(self.view.frame.size.width - viewAtRight.frame.size.width, viewAtRight.frame.origin.y, viewAtRight.frame.size.width,viewAtRight.frame.size.height)];
374 | [UIView commitAnimations];
375 | }
376 | else if (viewAtLeft.frame.origin.x == SLIDE_VIEWS_MINUS_X_POSITION && viewAtRight.frame.origin.x + viewAtRight.frame.size.width < self.view.frame.size.width) {
377 | [UIView beginAnimations:@"RIGHT-WITH-RIGHT" context:NULL];
378 | [UIView setAnimationDuration:0.2];
379 | [UIView setAnimationTransition:UIViewAnimationTransitionNone forView:nil cache:YES];
380 | [UIView setAnimationBeginsFromCurrentState:YES];
381 | [viewAtRight setFrame:CGRectMake(self.view.frame.size.width - viewAtRight.frame.size.width, viewAtRight.frame.origin.y, viewAtRight.frame.size.width,viewAtRight.frame.size.height)];
382 | [UIView setAnimationDelegate:self];
383 | [UIView setAnimationDidStopSelector:@selector(bounceBack:finished:context:)];
384 | [UIView commitAnimations];
385 | }
386 | else if (viewAtLeft.frame.origin.x > SLIDE_VIEWS_MINUS_X_POSITION) {
387 | [UIView setAnimationDuration:0.2];
388 | [UIView setAnimationTransition:UIViewAnimationTransitionNone forView:nil cache:YES];
389 | [UIView setAnimationBeginsFromCurrentState:YES];
390 | if ((viewAtLeft.frame.origin.x + viewAtLeft.frame.size.width > self.view.frame.size.width) && viewAtLeft.frame.origin.x < (self.view.frame.size.width - (viewAtLeft.frame.size.width)/2)) {
391 | [UIView beginAnimations:@"LEFT-WITH-LEFT" context:nil];
392 | [viewAtLeft setFrame:CGRectMake(self.view.frame.size.width - viewAtLeft.frame.size.width, viewAtLeft.frame.origin.y, viewAtLeft.frame.size.width, viewAtLeft.frame.size.height)];
393 |
394 | //Show bounce effect
395 | [viewAtRight setFrame:CGRectMake(self.view.frame.size.width, viewAtRight.frame.origin.y, viewAtRight.frame.size.width,viewAtRight.frame.size.height)];
396 | }
397 | else {
398 | [UIView beginAnimations:@"LEFT-WITH-RIGHT" context:nil];
399 | [viewAtLeft setFrame:CGRectMake(SLIDE_VIEWS_MINUS_X_POSITION, viewAtLeft.frame.origin.y, viewAtLeft.frame.size.width, viewAtLeft.frame.size.height)];
400 | if (positionOfViewAtLeftAtTouchBegan.x + viewAtLeft.frame.size.width <= self.view.frame.size.width) {
401 | [viewAtRight setFrame:CGRectMake((self.view.frame.size.width - viewAtRight.frame.size.width), viewAtRight.frame.origin.y, viewAtRight.frame.size.width,viewAtRight.frame.size.height)];
402 | }
403 | else{
404 | [viewAtRight setFrame:CGRectMake(SLIDE_VIEWS_MINUS_X_POSITION + viewAtLeft.frame.size.width, viewAtRight.frame.origin.y, viewAtRight.frame.size.width,viewAtRight.frame.size.height)];
405 | }
406 |
407 | //Show bounce effect
408 | [viewAtRight2 setFrame:CGRectMake(viewAtRight.frame.origin.x + viewAtRight.frame.size.width, viewAtRight2.frame.origin.y, viewAtRight2.frame.size.width, viewAtRight2.frame.size.height)];
409 | }
410 | [UIView setAnimationDelegate:self];
411 | [UIView setAnimationDidStopSelector:@selector(bounceBack:finished:context:)];
412 | [UIView commitAnimations];
413 | }
414 |
415 | }
416 | else{
417 | [UIView beginAnimations:nil context:NULL];
418 | [UIView setAnimationDuration:0.2];
419 | [UIView setAnimationBeginsFromCurrentState:YES];
420 | [UIView setAnimationTransition:UIViewAnimationTransitionNone forView:nil cache:YES];
421 | [viewAtLeft setFrame:CGRectMake(SLIDE_VIEWS_START_X_POS, viewAtLeft.frame.origin.y, viewAtLeft.frame.size.width, viewAtLeft.frame.size.height)];
422 | [UIView commitAnimations];
423 | }
424 |
425 | }else if ([dragDirection isEqualToString:@"RIGHT"]) {
426 | if (viewAtLeft != nil) {
427 | if ([[slideViews subviews] indexOfObject:viewAtLeft] == 0 && !(viewAtLeft.frame.origin.x == SLIDE_VIEWS_MINUS_X_POSITION || viewAtLeft.frame.origin.x == SLIDE_VIEWS_START_X_POS)) {
428 | [UIView beginAnimations:nil context:NULL];
429 | [UIView setAnimationDuration:0.2];
430 | [UIView setAnimationBeginsFromCurrentState:YES];
431 | [UIView setAnimationTransition:UIViewAnimationTransitionNone forView:nil cache:YES];
432 | if (viewAtLeft.frame.origin.x > SLIDE_VIEWS_MINUS_X_POSITION || viewAtRight == nil) {
433 |
434 | //Drop Card View Animation
435 | if ((((UIView*)[[slideViews subviews] objectAtIndex:0]).frame.origin.x+200) >= (self.view.frame.origin.x + ((UIView*)[[slideViews subviews] objectAtIndex:0]).frame.size.width)) {
436 | NSInteger viewControllerCount = [viewControllersStack count];
437 | if (viewControllerCount > 1) {
438 | for (int i = 1; i < viewControllerCount; i++) {
439 | viewXPosition = self.view.frame.size.width - [slideViews viewWithTag:i].frame.size.width;
440 | [[slideViews viewWithTag:i] removeFromSuperview];
441 | [viewControllersStack removeLastObject];
442 | }
443 | [[borderViews viewWithTag:3] setHidden:TRUE];
444 | [[borderViews viewWithTag:2] setHidden:TRUE];
445 | [[borderViews viewWithTag:1] setHidden:TRUE];
446 | }
447 |
448 | // Removes the selection of row for the first slide view
449 | for (UIView* tableView in [[[slideViews subviews] objectAtIndex:0] subviews]) {
450 | if([tableView isKindOfClass:[UITableView class]]){
451 | NSIndexPath* selectedRow = [(UITableView*)tableView indexPathForSelectedRow];
452 | NSArray *indexPaths = [NSArray arrayWithObjects:selectedRow, nil];
453 | [(UITableView*)tableView reloadRowsAtIndexPaths:indexPaths withRowAnimation:NO];
454 | }
455 | }
456 |
457 | viewAtLeft2 = nil;
458 | viewAtRight = nil;
459 | viewAtRight2 = nil;
460 | }
461 | [viewAtLeft setFrame:CGRectMake(SLIDE_VIEWS_START_X_POS, viewAtLeft.frame.origin.y, viewAtLeft.frame.size.width, viewAtLeft.frame.size.height)];
462 | if (viewAtRight != nil) {
463 | [viewAtRight setFrame:CGRectMake(SLIDE_VIEWS_START_X_POS + viewAtLeft.frame.size.width, viewAtRight.frame.origin.y, viewAtRight.frame.size.width,viewAtRight.frame.size.height)];
464 | }
465 | }
466 | else{
467 | [viewAtLeft setFrame:CGRectMake(SLIDE_VIEWS_MINUS_X_POSITION, viewAtLeft.frame.origin.y, viewAtLeft.frame.size.width, viewAtLeft.frame.size.height)];
468 | [viewAtRight setFrame:CGRectMake(SLIDE_VIEWS_MINUS_X_POSITION + viewAtLeft.frame.size.width, viewAtRight.frame.origin.y, viewAtRight.frame.size.width,viewAtRight.frame.size.height)];
469 | }
470 | [UIView commitAnimations];
471 | }
472 | else if (viewAtRight.frame.origin.x < self.view.frame.size.width) {
473 | if((viewAtRight.frame.origin.x < (viewAtLeft.frame.origin.x + viewAtLeft.frame.size.width)) && viewAtRight.frame.origin.x < (self.view.frame.size.width - (viewAtRight.frame.size.width/2))){
474 | [UIView beginAnimations:@"RIGHT-WITH-RIGHT" context:NULL];
475 | [UIView setAnimationDuration:0.2];
476 | [UIView setAnimationBeginsFromCurrentState:YES];
477 | [UIView setAnimationTransition:UIViewAnimationTransitionNone forView:nil cache:YES];
478 | [viewAtRight setFrame:CGRectMake(SLIDE_VIEWS_MINUS_X_POSITION + viewAtLeft.frame.size.width, viewAtRight.frame.origin.y, viewAtRight.frame.size.width,viewAtRight.frame.size.height)];
479 | [UIView setAnimationDelegate:self];
480 | [UIView setAnimationDidStopSelector:@selector(bounceBack:finished:context:)];
481 | [UIView commitAnimations];
482 | }
483 | else{
484 |
485 | [UIView beginAnimations:@"RIGHT-WITH-LEFT" context:NULL];
486 | [UIView setAnimationDuration:0.2];
487 | [UIView setAnimationBeginsFromCurrentState:YES];
488 | [UIView setAnimationTransition:UIViewAnimationTransitionNone forView:nil cache:YES];
489 | if([[slideViews subviews] indexOfObject:viewAtLeft] > 0){
490 | if (positionOfViewAtRightAtTouchBegan.x + viewAtRight.frame.size.width <= self.view.frame.size.width) {
491 | [viewAtLeft setFrame:CGRectMake(self.view.frame.size.width - viewAtLeft.frame.size.width, viewAtLeft.frame.origin.y, viewAtLeft.frame.size.width, viewAtLeft.frame.size.height)];
492 | }
493 | else{
494 | [viewAtLeft setFrame:CGRectMake(SLIDE_VIEWS_MINUS_X_POSITION + viewAtLeft2.frame.size.width, viewAtLeft.frame.origin.y, viewAtLeft.frame.size.width, viewAtLeft.frame.size.height)];
495 | }
496 | [viewAtRight setFrame:CGRectMake(self.view.frame.size.width, viewAtRight.frame.origin.y, viewAtRight.frame.size.width,viewAtRight.frame.size.height)];
497 | }
498 | else{
499 | [viewAtLeft setFrame:CGRectMake(SLIDE_VIEWS_MINUS_X_POSITION, viewAtLeft.frame.origin.y, viewAtLeft.frame.size.width, viewAtLeft.frame.size.height)];
500 | [viewAtRight setFrame:CGRectMake(SLIDE_VIEWS_MINUS_X_POSITION + viewAtLeft.frame.size.width, viewAtRight.frame.origin.y, viewAtRight.frame.size.width,viewAtRight.frame.size.height)];
501 | }
502 | [UIView setAnimationDelegate:self];
503 | [UIView setAnimationDidStopSelector:@selector(bounceBack:finished:context:)];
504 | [UIView commitAnimations];
505 | }
506 |
507 | }
508 | }
509 | }
510 | lastTouchPoint = -1;
511 | dragDirection = @"";
512 | }
513 |
514 | }
515 |
516 | - (void)bounceBack:(NSString*)animationID finished:(NSNumber*)finished context:(void*)context {
517 |
518 | BOOL isBouncing = FALSE;
519 |
520 | if([dragDirection isEqualToString:@""] && [finished boolValue]){
521 | [viewAtLeft.layer removeAllAnimations];
522 | [viewAtRight.layer removeAllAnimations];
523 | [viewAtRight2.layer removeAllAnimations];
524 | [viewAtLeft2.layer removeAllAnimations];
525 | if ([animationID isEqualToString:@"LEFT-WITH-LEFT"] && viewAtLeft2.frame.origin.x == SLIDE_VIEWS_MINUS_X_POSITION) {
526 | CABasicAnimation *bounceAnimation = [CABasicAnimation animationWithKeyPath:@"position.x"];
527 | bounceAnimation.duration = 0.2;
528 | bounceAnimation.fromValue = [NSNumber numberWithFloat:viewAtLeft.center.x];
529 | bounceAnimation.toValue = [NSNumber numberWithFloat:viewAtLeft.center.x -10];
530 | bounceAnimation.repeatCount = 0;
531 | bounceAnimation.autoreverses = YES;
532 | bounceAnimation.fillMode = kCAFillModeBackwards;
533 | bounceAnimation.removedOnCompletion = YES;
534 | bounceAnimation.additive = NO;
535 | [viewAtLeft.layer addAnimation:bounceAnimation forKey:@"bounceAnimation"];
536 |
537 | [viewAtRight setHidden:FALSE];
538 | CABasicAnimation *bounceAnimationForRight = [CABasicAnimation animationWithKeyPath:@"position.x"];
539 | bounceAnimationForRight.duration = 0.2;
540 | bounceAnimationForRight.fromValue = [NSNumber numberWithFloat:viewAtRight.center.x];
541 | bounceAnimationForRight.toValue = [NSNumber numberWithFloat:viewAtRight.center.x - 20];
542 | bounceAnimationForRight.repeatCount = 0;
543 | bounceAnimationForRight.autoreverses = YES;
544 | bounceAnimationForRight.fillMode = kCAFillModeBackwards;
545 | bounceAnimationForRight.removedOnCompletion = YES;
546 | bounceAnimationForRight.additive = NO;
547 | [viewAtRight.layer addAnimation:bounceAnimationForRight forKey:@"bounceAnimationRight"];
548 | }else if ([animationID isEqualToString:@"LEFT-WITH-RIGHT"] && viewAtLeft.frame.origin.x == SLIDE_VIEWS_MINUS_X_POSITION) {
549 | CABasicAnimation *bounceAnimation = [CABasicAnimation animationWithKeyPath:@"position.x"];
550 | bounceAnimation.duration = 0.2;
551 | bounceAnimation.fromValue = [NSNumber numberWithFloat:viewAtRight.center.x];
552 | bounceAnimation.toValue = [NSNumber numberWithFloat:viewAtRight.center.x - 10];
553 | bounceAnimation.repeatCount = 0;
554 | bounceAnimation.autoreverses = YES;
555 | bounceAnimation.fillMode = kCAFillModeBackwards;
556 | bounceAnimation.removedOnCompletion = YES;
557 | bounceAnimation.additive = NO;
558 | [viewAtRight.layer addAnimation:bounceAnimation forKey:@"bounceAnimation"];
559 |
560 |
561 | [viewAtRight2 setHidden:FALSE];
562 | CABasicAnimation *bounceAnimationForRight2 = [CABasicAnimation animationWithKeyPath:@"position.x"];
563 | bounceAnimationForRight2.duration = 0.2;
564 | bounceAnimationForRight2.fromValue = [NSNumber numberWithFloat:viewAtRight2.center.x];
565 | bounceAnimationForRight2.toValue = [NSNumber numberWithFloat:viewAtRight2.center.x - 20];
566 | bounceAnimationForRight2.repeatCount = 0;
567 | bounceAnimationForRight2.autoreverses = YES;
568 | bounceAnimationForRight2.fillMode = kCAFillModeBackwards;
569 | bounceAnimationForRight2.removedOnCompletion = YES;
570 | bounceAnimationForRight2.additive = NO;
571 | [viewAtRight2.layer addAnimation:bounceAnimationForRight2 forKey:@"bounceAnimationRight2"];
572 | }else if ([animationID isEqualToString:@"RIGHT-WITH-RIGHT"]) {
573 | CABasicAnimation *bounceAnimationLeft = [CABasicAnimation animationWithKeyPath:@"position.x"];
574 | bounceAnimationLeft.duration = 0.2;
575 | bounceAnimationLeft.fromValue = [NSNumber numberWithFloat:viewAtLeft.center.x];
576 | bounceAnimationLeft.toValue = [NSNumber numberWithFloat:viewAtLeft.center.x + 10];
577 | bounceAnimationLeft.repeatCount = 0;
578 | bounceAnimationLeft.autoreverses = YES;
579 | bounceAnimationLeft.fillMode = kCAFillModeBackwards;
580 | bounceAnimationLeft.removedOnCompletion = YES;
581 | bounceAnimationLeft.additive = NO;
582 | [viewAtLeft.layer addAnimation:bounceAnimationLeft forKey:@"bounceAnimationLeft"];
583 |
584 | CABasicAnimation *bounceAnimationRight = [CABasicAnimation animationWithKeyPath:@"position.x"];
585 | bounceAnimationRight.duration = 0.2;
586 | bounceAnimationRight.fromValue = [NSNumber numberWithFloat:viewAtRight.center.x];
587 | bounceAnimationRight.toValue = [NSNumber numberWithFloat:viewAtRight.center.x + 10];
588 | bounceAnimationRight.repeatCount = 0;
589 | bounceAnimationRight.autoreverses = YES;
590 | bounceAnimationRight.fillMode = kCAFillModeBackwards;
591 | bounceAnimationRight.removedOnCompletion = YES;
592 | bounceAnimationRight.additive = NO;
593 | [viewAtRight.layer addAnimation:bounceAnimationRight forKey:@"bounceAnimationRight"];
594 |
595 | }else if ([animationID isEqualToString:@"RIGHT-WITH-LEFT"]) {
596 | CABasicAnimation *bounceAnimationLeft = [CABasicAnimation animationWithKeyPath:@"position.x"];
597 | bounceAnimationLeft.duration = 0.2;
598 | bounceAnimationLeft.fromValue = [NSNumber numberWithFloat:viewAtLeft.center.x];
599 | bounceAnimationLeft.toValue = [NSNumber numberWithFloat:viewAtLeft.center.x + 10];
600 | bounceAnimationLeft.repeatCount = 0;
601 | bounceAnimationLeft.autoreverses = YES;
602 | bounceAnimationLeft.fillMode = kCAFillModeBackwards;
603 | bounceAnimationLeft.removedOnCompletion = YES;
604 | bounceAnimationLeft.additive = NO;
605 | [viewAtLeft.layer addAnimation:bounceAnimationLeft forKey:@"bounceAnimationLeft"];
606 |
607 | if (viewAtLeft2 != nil) {
608 | [viewAtLeft2 setHidden:FALSE];
609 | NSInteger viewAtLeft2Position = [[slideViews subviews] indexOfObject:viewAtLeft2];
610 | if (viewAtLeft2Position > 0) {
611 | [((UIView*)[[slideViews subviews] objectAtIndex:viewAtLeft2Position -1]) setHidden:FALSE];
612 | }
613 | CABasicAnimation* bounceAnimationLeft2 = [CABasicAnimation animationWithKeyPath:@"position.x"];
614 | bounceAnimationLeft2.duration = 0.2;
615 | bounceAnimationLeft2.fromValue = [NSNumber numberWithFloat:viewAtLeft2.center.x];
616 | bounceAnimationLeft2.toValue = [NSNumber numberWithFloat:viewAtLeft2.center.x + 10];
617 | bounceAnimationLeft2.repeatCount = 0;
618 | bounceAnimationLeft2.autoreverses = YES;
619 | bounceAnimationLeft2.fillMode = kCAFillModeBackwards;
620 | bounceAnimationLeft2.removedOnCompletion = YES;
621 | bounceAnimationLeft2.additive = NO;
622 | [viewAtLeft2.layer addAnimation:bounceAnimationLeft2 forKey:@"bounceAnimationviewAtLeft2"];
623 | [self performSelector:@selector(callArrangeVerticalBar) withObject:nil afterDelay:0.4];
624 | isBouncing = TRUE;
625 | }
626 |
627 | }
628 |
629 | }
630 | [self arrangeVerticalBar];
631 | if ([[slideViews subviews] indexOfObject:viewAtLeft2] == 1 && isBouncing) {
632 | [[borderViews viewWithTag:2] setHidden:TRUE];
633 | }
634 | }
635 |
636 |
637 | - (void)callArrangeVerticalBar{
638 | [self arrangeVerticalBar];
639 | }
640 |
641 | - (void)loadView {
642 | [super loadView];
643 | }
644 |
645 | // Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
646 | - (void)viewDidLoad {
647 | [super viewDidLoad];
648 | }
649 |
650 | - (void) viewWillAppear:(BOOL)animated {
651 | [super viewWillAppear:animated];
652 | }
653 |
654 | - (void)addViewInSlider:(UIViewController*)controller invokeByController:(UIViewController*)invokeByController isStackStartView:(BOOL)isStackStartView{
655 |
656 | if (isStackStartView) {
657 | slideStartPosition = SLIDE_VIEWS_START_X_POS;
658 | viewXPosition = slideStartPosition;
659 |
660 | for (UIView* subview in [slideViews subviews]) {
661 | [subview removeFromSuperview];
662 | }
663 |
664 | [[borderViews viewWithTag:3] setHidden:TRUE];
665 | [[borderViews viewWithTag:2] setHidden:TRUE];
666 | [[borderViews viewWithTag:1] setHidden:TRUE];
667 | [viewControllersStack removeAllObjects];
668 | }
669 |
670 |
671 | if([viewControllersStack count] > 1){
672 | NSInteger indexOfViewController = [viewControllersStack
673 | indexOfObject:invokeByController]+1;
674 |
675 | if ([invokeByController parentViewController]) {
676 | indexOfViewController = [viewControllersStack
677 | indexOfObject:[invokeByController parentViewController]]+1;
678 | }
679 |
680 | NSInteger viewControllerCount = [viewControllersStack count];
681 | for (int i = indexOfViewController; i < viewControllerCount; i++) {
682 | [[slideViews viewWithTag:i] removeFromSuperview];
683 | [viewControllersStack removeObjectAtIndex:indexOfViewController];
684 | viewXPosition = self.view.frame.size.width - [controller view].frame.size.width;
685 | }
686 | }else if([viewControllersStack count] == 0) {
687 | for (UIView* subview in [slideViews subviews]) {
688 | [subview removeFromSuperview];
689 | } [viewControllersStack removeAllObjects];
690 | [[borderViews viewWithTag:3] setHidden:TRUE];
691 | [[borderViews viewWithTag:2] setHidden:TRUE];
692 | [[borderViews viewWithTag:1] setHidden:TRUE];
693 | }
694 |
695 | if ([slideViews.subviews count] != 0) {
696 | UIViewWithShadow* verticalLineView = [[[UIViewWithShadow alloc] initWithFrame:CGRectMake(-40, 0, 40 , self.view.frame.size.height)] autorelease];
697 | [verticalLineView setBackgroundColor:[UIColor clearColor]];
698 | [verticalLineView setAutoresizingMask:UIViewAutoresizingFlexibleHeight];
699 | [verticalLineView setClipsToBounds:NO];
700 | [controller.view addSubview:verticalLineView];
701 | }
702 |
703 | [viewControllersStack addObject:controller];
704 | if (invokeByController !=nil) {
705 | viewXPosition = invokeByController.view.frame.origin.x + invokeByController.view.frame.size.width;
706 | }
707 | if ([[slideViews subviews] count] == 0) {
708 | slideStartPosition = SLIDE_VIEWS_START_X_POS;
709 | viewXPosition = slideStartPosition;
710 | }
711 | [[controller view] setFrame:CGRectMake(viewXPosition, 0, [controller view].frame.size.width, self.view.frame.size.height)];
712 |
713 | [controller.view setTag:([viewControllersStack count]-1)];
714 | [controller viewWillAppear:FALSE];
715 | [controller viewDidAppear:FALSE];
716 | [slideViews addSubview:[controller view]];
717 |
718 |
719 | if ([[slideViews subviews] count] > 0) {
720 |
721 | if ([[slideViews subviews] count]==1) {
722 | viewAtLeft = [[slideViews subviews] objectAtIndex:[[slideViews subviews] count]-1];
723 | viewAtLeft2 = nil;
724 | viewAtRight = nil;
725 | viewAtRight2 = nil;
726 |
727 | }else if ([[slideViews subviews] count]==2){
728 | viewAtRight = [[slideViews subviews] objectAtIndex:[[slideViews subviews] count]-1];
729 | viewAtLeft = [[slideViews subviews] objectAtIndex:[[slideViews subviews] count]-2];
730 | viewAtLeft2 = nil;
731 | viewAtRight2 = nil;
732 |
733 | [UIView beginAnimations:nil context:NULL];
734 | [UIView setAnimationTransition:UIViewAnimationTransitionNone forView:viewAtLeft cache:YES];
735 | [UIView setAnimationBeginsFromCurrentState:NO];
736 | [viewAtLeft setFrame:CGRectMake(SLIDE_VIEWS_MINUS_X_POSITION, viewAtLeft.frame.origin.y, viewAtLeft.frame.size.width, viewAtLeft.frame.size.height)];
737 | [viewAtRight setFrame:CGRectMake(self.view.frame.size.width - viewAtRight.frame.size.width, viewAtRight.frame.origin.y, viewAtRight.frame.size.width, viewAtRight.frame.size.height)];
738 | [UIView commitAnimations];
739 | slideStartPosition = SLIDE_VIEWS_MINUS_X_POSITION;
740 |
741 | }else {
742 |
743 |
744 | viewAtRight = [[slideViews subviews] objectAtIndex:[[slideViews subviews] count]-1];
745 | viewAtLeft = [[slideViews subviews] objectAtIndex:[[slideViews subviews] count]-2];
746 | viewAtLeft2 = [[slideViews subviews] objectAtIndex:[[slideViews subviews] count]-3];
747 | [viewAtLeft2 setHidden:FALSE];
748 | viewAtRight2 = nil;
749 |
750 | [UIView beginAnimations:nil context:NULL];
751 | [UIView setAnimationTransition:UIViewAnimationTransitionNone forView:viewAtLeft cache:YES];
752 | [UIView setAnimationBeginsFromCurrentState:NO];
753 |
754 | if (viewAtLeft2.frame.origin.x != SLIDE_VIEWS_MINUS_X_POSITION) {
755 | [viewAtLeft2 setFrame:CGRectMake(SLIDE_VIEWS_MINUS_X_POSITION, viewAtLeft2.frame.origin.y, viewAtLeft2.frame.size.width, viewAtLeft2.frame.size.height)];
756 | }
757 | [viewAtLeft setFrame:CGRectMake(SLIDE_VIEWS_MINUS_X_POSITION, viewAtLeft.frame.origin.y, viewAtLeft.frame.size.width, viewAtLeft.frame.size.height)];
758 | [viewAtRight setFrame:CGRectMake(self.view.frame.size.width - viewAtRight.frame.size.width, viewAtRight.frame.origin.y, viewAtRight.frame.size.width, viewAtRight.frame.size.height)];
759 | [UIView setAnimationDelegate:self];
760 | [UIView setAnimationDidStopSelector:@selector(bounceBack:finished:context:)];
761 | [UIView commitAnimations];
762 | slideStartPosition = SLIDE_VIEWS_MINUS_X_POSITION;
763 | if([[slideViews subviews] count] > 3){
764 | [[[slideViews subviews] objectAtIndex:[[slideViews subviews] count]-4] setHidden:TRUE];
765 | }
766 |
767 |
768 | }
769 | }
770 | }
771 |
772 | - (void)didReceiveMemoryWarning {
773 | [super didReceiveMemoryWarning];
774 | }
775 |
776 | - (void)viewDidUnload {
777 | [super viewDidUnload];
778 | for (UIViewController* subController in viewControllersStack) {
779 | [subController viewDidUnload];
780 | }
781 | }
782 |
783 |
784 | #pragma mark -
785 | #pragma mark Rotation support
786 |
787 |
788 | // Ensure that the view controller supports rotation and that the split view can therefore show in both portrait and landscape.
789 | - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
790 | return YES;
791 | }
792 |
793 |
794 | -(void) willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration{
795 | BOOL isViewOutOfScreen = FALSE;
796 | for (UIViewController* subController in viewControllersStack) {
797 | if (viewAtRight != nil && [viewAtRight isEqual:subController.view]) {
798 | if (viewAtRight.frame.origin.x <= (viewAtLeft.frame.origin.x + viewAtLeft.frame.size.width)) {
799 | [subController.view setFrame:CGRectMake(self.view.frame.size.width - subController.view.frame.size.width, subController.view.frame.origin.y, subController.view.frame.size.width, self.view.frame.size.height)];
800 | }else{
801 | [subController.view setFrame:CGRectMake(viewAtLeft.frame.origin.x + viewAtLeft.frame.size.width, subController.view.frame.origin.y, subController.view.frame.size.width, self.view.frame.size.height)];
802 | }
803 | isViewOutOfScreen = TRUE;
804 | }
805 | else if (viewAtLeft != nil && [viewAtLeft isEqual:subController.view]) {
806 | if (viewAtLeft2 == nil) {
807 | if(viewAtRight == nil){
808 | [subController.view setFrame:CGRectMake(SLIDE_VIEWS_START_X_POS, subController.view.frame.origin.y, subController.view.frame.size.width, self.view.frame.size.height)];
809 | }
810 | else{
811 | [subController.view setFrame:CGRectMake(SLIDE_VIEWS_MINUS_X_POSITION, subController.view.frame.origin.y, subController.view.frame.size.width, self.view.frame.size.height)];
812 | [viewAtRight setFrame:CGRectMake(SLIDE_VIEWS_MINUS_X_POSITION + subController.view.frame.size.width, viewAtRight.frame.origin.y, viewAtRight.frame.size.width, viewAtRight.frame.size.height)];
813 | }
814 | }
815 | else if (viewAtLeft.frame.origin.x == SLIDE_VIEWS_MINUS_X_POSITION || viewAtLeft.frame.origin.x == SLIDE_VIEWS_START_X_POS) {
816 | [subController.view setFrame:CGRectMake(subController.view.frame.origin.x, subController.view.frame.origin.y, subController.view.frame.size.width, self.view.frame.size.height)];
817 | }
818 | else {
819 | if (viewAtLeft.frame.origin.x + viewAtLeft.frame.size.width == self.view.frame.size.width) {
820 | [subController.view setFrame:CGRectMake(self.view.frame.size.width - subController.view.frame.size.width, subController.view.frame.origin.y, subController.view.frame.size.width, self.view.frame.size.height)];
821 | }else{
822 | [subController.view setFrame:CGRectMake(viewAtLeft2.frame.origin.x + viewAtLeft2.frame.size.width, subController.view.frame.origin.y, subController.view.frame.size.width, self.view.frame.size.height)];
823 | }
824 | }
825 | }
826 | else if(!isViewOutOfScreen){
827 | [subController.view setFrame:CGRectMake(subController.view.frame.origin.x, subController.view.frame.origin.y, subController.view.frame.size.width, self.view.frame.size.height)];
828 | }
829 | else {
830 | [subController.view setFrame:CGRectMake(self.view.frame.size.width, subController.view.frame.origin.y, subController.view.frame.size.width, self.view.frame.size.height)];
831 | }
832 |
833 | }
834 | for (UIViewController* subController in viewControllersStack) {
835 | [subController willAnimateRotationToInterfaceOrientation:toInterfaceOrientation duration:duration];
836 | if (!((viewAtRight != nil && [viewAtRight isEqual:subController.view]) || (viewAtLeft != nil && [viewAtLeft isEqual:subController.view]) || (viewAtLeft2 != nil && [viewAtLeft2 isEqual:subController.view]))) {
837 | [[subController view] setHidden:TRUE];
838 | }
839 |
840 | }
841 |
842 | }
843 |
844 | - (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation {
845 | for (UIViewController* subController in viewControllersStack) {
846 | [subController didRotateFromInterfaceOrientation:fromInterfaceOrientation];
847 | }
848 | if (viewAtLeft !=nil) {
849 | [viewAtLeft setHidden:FALSE];
850 | }
851 | if (viewAtRight !=nil) {
852 | [viewAtRight setHidden:FALSE];
853 | }
854 | if (viewAtLeft2 !=nil) {
855 | [viewAtLeft2 setHidden:FALSE];
856 | }
857 | }
858 |
859 | - (void)dealloc {
860 | [slideViews release];
861 | [viewControllersStack release];
862 | [super dealloc];
863 | }
864 |
865 |
866 | @end
--------------------------------------------------------------------------------