├── .gitignore
├── LICENSE
├── Podfile
├── README.md
├── XLMailBoxContainer.podspec
├── XLMailBoxContainer.xcodeproj
├── project.pbxproj
├── project.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcuserdata
│ │ └── barreto.xcuserdatad
│ │ └── WorkspaceSettings.xcsettings
└── xcuserdata
│ └── barreto.xcuserdatad
│ ├── xcdebugger
│ └── Breakpoints_v2.xcbkptlist
│ └── xcschemes
│ ├── XLMailBoxContainer.xcscheme
│ └── xcschememanagement.plist
├── XLMailBoxContainer
├── AppDelegate.h
├── AppDelegate.m
├── Demo
│ ├── BarContainerViewController.h
│ ├── BarContainerViewController.m
│ ├── ButtonContainerViewController.h
│ ├── ButtonContainerViewController.m
│ ├── ChildViewController
│ │ ├── MailBoxChildViewController.h
│ │ ├── MailBoxChildViewController.m
│ │ ├── MailBoxTableChildViewController.h
│ │ ├── MailBoxTableChildViewController.m
│ │ └── Views
│ │ │ ├── PostCell.h
│ │ │ └── PostCell.m
│ ├── Helpers
│ │ ├── XLJSONSerialization.h
│ │ └── XLJSONSerialization.m
│ ├── SegmentedContainerViewController.h
│ ├── SegmentedContainerViewController.m
│ └── Storyboard.storyboard
├── Images.xcassets
│ ├── AppIcon.appiconset
│ │ ├── Contents.json
│ │ ├── xl_appicon_120.png
│ │ ├── xl_appicon_58.png
│ │ └── xl_appicon_80.png
│ ├── LaunchImage.launchimage
│ │ ├── Contents.json
│ │ └── xl_splash@2x.png
│ ├── Simpsons
│ │ ├── Apu_Nahasapeemapetilon.imageset
│ │ │ ├── Apu_Nahasapeemapetilon.png
│ │ │ └── Contents.json
│ │ ├── Bart_Simpsons.imageset
│ │ │ ├── Bart_Simpsons.png
│ │ │ └── Contents.json
│ │ ├── Homer_Simpsons.imageset
│ │ │ ├── Contents.json
│ │ │ └── Homer_Simpsons.png
│ │ ├── Lisa_Simpsons.imageset
│ │ │ ├── Contents.json
│ │ │ └── Lisa_Simpsons.png
│ │ ├── Maggie_Simpsons.imageset
│ │ │ ├── Contents.json
│ │ │ └── Maggie_Simpsons.png
│ │ ├── Marge_Simpsons.imageset
│ │ │ ├── Contents.json
│ │ │ └── Marge_Simpsons.png
│ │ ├── Montgomery_Burns.imageset
│ │ │ ├── Contents.json
│ │ │ └── Montgomery_Burns.png
│ │ ├── Ned_Flanders.imageset
│ │ │ ├── Contents.json
│ │ │ └── Ned_Flanders.png
│ │ ├── Otto_Mann.imageset
│ │ │ ├── Contents.json
│ │ │ └── Otto_Mann.png
│ │ └── default-avatar.imageset
│ │ │ ├── Contents.json
│ │ │ └── default-avatar@2x.png
│ └── TabBar
│ │ ├── Posts_Selected.imageset
│ │ ├── Contents.json
│ │ └── Posts_Selected.png
│ │ ├── Posts_Unselected.imageset
│ │ ├── Contents.json
│ │ └── Posts_Unselected.png
│ │ ├── Users_Selected.imageset
│ │ ├── Contents.json
│ │ └── Users_Selected.png
│ │ └── Users_Unselected.imageset
│ │ ├── Contents.json
│ │ └── Users_Unselected.png
├── XL
│ ├── Views
│ │ ├── XLSwipeBarView.h
│ │ ├── XLSwipeBarView.m
│ │ ├── XLSwipeButtonBarView.h
│ │ ├── XLSwipeButtonBarView.m
│ │ ├── XLSwipeButtonBarViewCell.h
│ │ └── XLSwipeButtonBarViewCell.m
│ ├── XLBarSwipeContainerController.h
│ ├── XLBarSwipeContainerController.m
│ ├── XLButtonBarSwipeContainerController.h
│ ├── XLButtonBarSwipeContainerController.m
│ ├── XLSegmentedSwipeContainerController.h
│ ├── XLSegmentedSwipeContainerController.m
│ ├── XLSwipeContainerController.h
│ └── XLSwipeContainerController.m
├── XLMailBoxContainer-Info.plist
├── XLMailBoxContainer-Prefix.pch
├── en.lproj
│ └── InfoPlist.strings
└── main.m
├── XLMailBoxContainerTests
├── XLMailBoxContainerTests-Info.plist
├── XLMailBoxContainerTests.m
└── en.lproj
│ └── InfoPlist.strings
└── example.gif
/.gitignore:
--------------------------------------------------------------------------------
1 | # Xcode
2 | .DS_Store
3 | */build/*
4 | *.pbxuser
5 | !default.pbxuser
6 | *.mode1v3
7 | !default.mode1v3
8 | *.mode2v3
9 | !default.mode2v3
10 | *.perspectivev3
11 | !default.perspectivev3
12 | xcuserdata
13 | profile
14 | *.moved-aside
15 | DerivedData
16 | .idea/
17 | *.hmap
18 | *.xccheckout
19 |
20 | #CocoaPods
21 | Pods
22 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2014 xmartlabs
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | this software and associated documentation files (the "Software"), to deal in
7 | the Software without restriction, including without limitation the rights to
8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | the Software, and to permit persons to whom the Software is furnished to do so,
10 | subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 |
--------------------------------------------------------------------------------
/Podfile:
--------------------------------------------------------------------------------
1 | platform :ios, '7.0'
2 |
3 | pod 'XLDataLoader', '~> 1.1', :inhibit_warnings => true
4 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | XLMailBoxContainer
2 | ==================
3 |
4 | ###This repository is no longer maintained. Take a look at [XLPagerTabStrip](https://github.com/xmartlabs/XLPagerTabStrip) for a better solution.
5 |
6 |
7 | By [XMARTLABS](http://xmartlabs.com).
8 |
9 | Custom container view controller ala MailBox app.
10 |
11 | `XLSwipeContainerController` is the most important class of the library. Just using this class you can get the same functionality shown on the gif bellow.
12 |
13 | XLSwipeContainerController handles a collection of childViewControllers created by the developer and also manages a UISegmentedControl, adding it to the parent UINavigationController and changing the color of it depending on which child view controller is selected.
14 |
15 | `XLSwipeNavigationController` give us the possibility to create the UINavigationController along with the XLSwipeContainerController just passing a list of childViewControllets.
16 |
17 | Each childViewController must conform `XLSwipeContainerChildItem` protocol.
18 |
19 | You can use this pod along with [MCSwipeTableViewCell](https://github.com/alikaragoz/MCSwipeTableViewCell) to create an app that looks like MailBox app.
20 |
21 |
22 |
23 |

24 |
25 |
26 | Installation
27 | --------
28 |
29 | The easiest way to integrate XLMailBoxContainer in your projects is via [CocoaPods](http://cocoapods.org).
30 |
31 | 1. Add the following line in the project's Podfile file.
32 |
33 | `pod 'XLMailBoxContainer'`
34 |
35 | 2. Run the command `pod install` from the Podfile folder directory.
36 |
37 | You can also install XLMailBoxContainer manually. We don't recommend this approach at all.
38 | The source files you will need are included in XLMailBoxContainer/XL folder.
39 |
40 |
41 | Example
42 | --------
43 |
44 | Look at AppDelegate.m file.
45 |
46 | The first think we should do is create each child viewController.
47 |
48 | ```objc
49 | // create child view controllers that will be managed by XLSwipeContainerController
50 | MailBoxTableChildViewController * child_1 = [[MailBoxTableChildViewController alloc] initWithStyle:UITableViewStylePlain];
51 | MailBoxChildViewController * child_2 = [[MailBoxChildViewController alloc] init];
52 | MailBoxTableChildViewController * child_3 = [[MailBoxTableChildViewController alloc] initWithStyle:UITableViewStyleGrouped];
53 | MailBoxChildViewController * child_4 = [[MailBoxChildViewController alloc] init];
54 | ```
55 |
56 | The second step is either create XLSwipeNavigationController using the child view controllers previously created or set up a XLSwipeContainerController and set it as rootViewController of any UINavigationController.
57 |
58 | ```objc
59 | // create XLSwipeNavigationController using the child view controllers previously created
60 | self.window.rootViewController = [[XLSwipeNavigationController alloc] initWithViewControllers:child_1, child_2, child_3, child_4, nil];
61 | ```
62 | or
63 |
64 | ```objc
65 | NSArray * childViewControllers = @[child_1, child_2 ,child_3 ,child_4];
66 | XLSwipeContainerController * containerController = [[XLSwipeContainerController alloc] initWithViewControllers:childViewControllers];
67 | self.window.rootViewController = [[UINavigationController alloc] initWithRootViewController:containerController];
68 | ```
69 |
70 | That's all folks!
71 |
72 | XLMailBoxContainer files
73 | --------
74 |
75 | 1. `XLSwipeContainerController` handles a collection of childViewControllers created by the developer and also manages a UISegmentedControl, adding it to the parent UINavigationController and changing the color of it depending on which child view controller is selected.
76 |
77 | 2. `XLSwipeNavigationController` give us the possibility to create the UINavigationController along with the XLSwipeContainerController just passing a list of childViewControllets.
78 |
79 | License
80 | --------
81 | XLMailBoxContainer is distributed under MIT license, please feel free to use it and contribute.
82 |
83 | Contact
84 | --------
85 |
86 | If you are using XLMailBoxContainer in your project and have any suggestion or question:
87 |
88 | Martin Barreto,
89 |
90 | [@Xmartlabs](http://www.xmartlabs.com)
91 |
--------------------------------------------------------------------------------
/XLMailBoxContainer.podspec:
--------------------------------------------------------------------------------
1 | Pod::Spec.new do |s|
2 | s.name = 'XLMailBoxContainer'
3 | s.version = '1.0.0'
4 | s.license = 'MIT'
5 | s.summary = 'Custom container view controller ala MailBox app.'
6 | s.description = <<-DESC
7 | Custom container view controller ala MailBox app. It uses a segmented control as a navbar and animates view controller transitions.
8 | DESC
9 | s.homepage = 'https://github.com/xmartlabs/XLMailBoxContainer'
10 | s.authors = { 'Martin Barreto' => 'martin@xmartlabs.com' }
11 | s.source = { :git => 'https://github.com/xmartlabs/XLMailBoxContainer.git', :tag => 'v1.0.0' }
12 | s.source_files = 'XLMailBoxContainer/XL/**/*.{h,m}'
13 | s.requires_arc = true
14 | s.ios.deployment_target = '7.0'
15 | s.ios.frameworks = 'UIKit', 'Foundation'
16 | end
17 |
--------------------------------------------------------------------------------
/XLMailBoxContainer.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 282ECBAB19CDED3F00026184 /* XLJSONSerialization.m in Sources */ = {isa = PBXBuildFile; fileRef = 282ECBAA19CDED3F00026184 /* XLJSONSerialization.m */; };
11 | 282ECBAE19CDED5B00026184 /* XLSwipeBarView.m in Sources */ = {isa = PBXBuildFile; fileRef = 282ECBAD19CDED5B00026184 /* XLSwipeBarView.m */; };
12 | 282ECBB219CDF40900026184 /* PostCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 282ECBB119CDF40900026184 /* PostCell.m */; };
13 | 283BCCD319CFB77B0025E21D /* SegmentedContainerViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 283BCCD219CFB77B0025E21D /* SegmentedContainerViewController.m */; };
14 | 285BE80418BE20CA00863AE4 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 285BE80318BE20CA00863AE4 /* Foundation.framework */; };
15 | 285BE80618BE20CA00863AE4 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 285BE80518BE20CA00863AE4 /* CoreGraphics.framework */; };
16 | 285BE80818BE20CA00863AE4 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 285BE80718BE20CA00863AE4 /* UIKit.framework */; };
17 | 285BE80E18BE20CA00863AE4 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 285BE80C18BE20CA00863AE4 /* InfoPlist.strings */; };
18 | 285BE81018BE20CA00863AE4 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 285BE80F18BE20CA00863AE4 /* main.m */; };
19 | 285BE81418BE20CA00863AE4 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 285BE81318BE20CA00863AE4 /* AppDelegate.m */; };
20 | 285BE81618BE20CA00863AE4 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 285BE81518BE20CA00863AE4 /* Images.xcassets */; };
21 | 285BE81D18BE20CA00863AE4 /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 285BE81C18BE20CA00863AE4 /* XCTest.framework */; };
22 | 285BE81E18BE20CA00863AE4 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 285BE80318BE20CA00863AE4 /* Foundation.framework */; };
23 | 285BE81F18BE20CA00863AE4 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 285BE80718BE20CA00863AE4 /* UIKit.framework */; };
24 | 285BE82718BE20CA00863AE4 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 285BE82518BE20CA00863AE4 /* InfoPlist.strings */; };
25 | 285BE82918BE20CA00863AE4 /* XLMailBoxContainerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 285BE82818BE20CA00863AE4 /* XLMailBoxContainerTests.m */; };
26 | 285BE83918BE24CE00863AE4 /* XLSwipeContainerController.m in Sources */ = {isa = PBXBuildFile; fileRef = 285BE83418BE24CE00863AE4 /* XLSwipeContainerController.m */; };
27 | 285BE84018BE278000863AE4 /* MailBoxTableChildViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 285BE83F18BE278000863AE4 /* MailBoxTableChildViewController.m */; };
28 | 285BE84618BEC5B300863AE4 /* MailBoxChildViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 285BE84518BEC5B300863AE4 /* MailBoxChildViewController.m */; };
29 | 28C0745719CB332B00D6ACA8 /* XLSegmentedSwipeContainerController.m in Sources */ = {isa = PBXBuildFile; fileRef = 28C0745619CB332B00D6ACA8 /* XLSegmentedSwipeContainerController.m */; };
30 | 28C0745919CB6BC800D6ACA8 /* Storyboard.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 28C0745819CB6BC800D6ACA8 /* Storyboard.storyboard */; };
31 | 28C0745C19CB6F3600D6ACA8 /* BarContainerViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 28C0745B19CB6F3600D6ACA8 /* BarContainerViewController.m */; };
32 | 28C0746619CCA13C00D6ACA8 /* XLBarSwipeContainerController.m in Sources */ = {isa = PBXBuildFile; fileRef = 28C0746519CCA13C00D6ACA8 /* XLBarSwipeContainerController.m */; };
33 | 28C0746919CCDFFC00D6ACA8 /* XLSwipeButtonBarView.m in Sources */ = {isa = PBXBuildFile; fileRef = 28C0746819CCDFFC00D6ACA8 /* XLSwipeButtonBarView.m */; };
34 | 28C0746C19CCF35B00D6ACA8 /* XLButtonBarSwipeContainerController.m in Sources */ = {isa = PBXBuildFile; fileRef = 28C0746B19CCF35B00D6ACA8 /* XLButtonBarSwipeContainerController.m */; };
35 | 28DA810719D8AC9200B7B2DB /* XLSwipeButtonBarViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 28DA810619D8AC9200B7B2DB /* XLSwipeButtonBarViewCell.m */; };
36 | 28DA810A19D8C58600B7B2DB /* ButtonContainerViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 28DA810919D8C58600B7B2DB /* ButtonContainerViewController.m */; };
37 | /* End PBXBuildFile section */
38 |
39 | /* Begin PBXContainerItemProxy section */
40 | 285BE82018BE20CA00863AE4 /* PBXContainerItemProxy */ = {
41 | isa = PBXContainerItemProxy;
42 | containerPortal = 285BE7F818BE20CA00863AE4 /* Project object */;
43 | proxyType = 1;
44 | remoteGlobalIDString = 285BE7FF18BE20CA00863AE4;
45 | remoteInfo = XLMailBoxContainer;
46 | };
47 | /* End PBXContainerItemProxy section */
48 |
49 | /* Begin PBXFileReference section */
50 | 282ECBA919CDED3F00026184 /* XLJSONSerialization.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = XLJSONSerialization.h; path = Demo/Helpers/XLJSONSerialization.h; sourceTree = ""; };
51 | 282ECBAA19CDED3F00026184 /* XLJSONSerialization.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = XLJSONSerialization.m; path = Demo/Helpers/XLJSONSerialization.m; sourceTree = ""; };
52 | 282ECBAC19CDED5B00026184 /* XLSwipeBarView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = XLSwipeBarView.h; path = XL/Views/XLSwipeBarView.h; sourceTree = ""; };
53 | 282ECBAD19CDED5B00026184 /* XLSwipeBarView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = XLSwipeBarView.m; path = XL/Views/XLSwipeBarView.m; sourceTree = ""; };
54 | 282ECBB019CDF40900026184 /* PostCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PostCell.h; sourceTree = ""; };
55 | 282ECBB119CDF40900026184 /* PostCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PostCell.m; sourceTree = ""; };
56 | 283BCCD119CFB77B0025E21D /* SegmentedContainerViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SegmentedContainerViewController.h; path = Demo/SegmentedContainerViewController.h; sourceTree = ""; };
57 | 283BCCD219CFB77B0025E21D /* SegmentedContainerViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SegmentedContainerViewController.m; path = Demo/SegmentedContainerViewController.m; sourceTree = ""; };
58 | 285BE80018BE20CA00863AE4 /* XLMailBoxContainer.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = XLMailBoxContainer.app; sourceTree = BUILT_PRODUCTS_DIR; };
59 | 285BE80318BE20CA00863AE4 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
60 | 285BE80518BE20CA00863AE4 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
61 | 285BE80718BE20CA00863AE4 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
62 | 285BE80B18BE20CA00863AE4 /* XLMailBoxContainer-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "XLMailBoxContainer-Info.plist"; sourceTree = ""; };
63 | 285BE80D18BE20CA00863AE4 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; };
64 | 285BE80F18BE20CA00863AE4 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; };
65 | 285BE81118BE20CA00863AE4 /* XLMailBoxContainer-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "XLMailBoxContainer-Prefix.pch"; sourceTree = ""; };
66 | 285BE81218BE20CA00863AE4 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; };
67 | 285BE81318BE20CA00863AE4 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; };
68 | 285BE81518BE20CA00863AE4 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; };
69 | 285BE81B18BE20CA00863AE4 /* XLMailBoxContainerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = XLMailBoxContainerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
70 | 285BE81C18BE20CA00863AE4 /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; };
71 | 285BE82418BE20CA00863AE4 /* XLMailBoxContainerTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "XLMailBoxContainerTests-Info.plist"; sourceTree = ""; };
72 | 285BE82618BE20CA00863AE4 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; };
73 | 285BE82818BE20CA00863AE4 /* XLMailBoxContainerTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XLMailBoxContainerTests.m; sourceTree = ""; };
74 | 285BE83318BE24CE00863AE4 /* XLSwipeContainerController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; name = XLSwipeContainerController.h; path = XL/XLSwipeContainerController.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
75 | 285BE83418BE24CE00863AE4 /* XLSwipeContainerController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; name = XLSwipeContainerController.m; path = XL/XLSwipeContainerController.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
76 | 285BE83E18BE278000863AE4 /* MailBoxTableChildViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; name = MailBoxTableChildViewController.h; path = Demo/ChildViewController/MailBoxTableChildViewController.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
77 | 285BE83F18BE278000863AE4 /* MailBoxTableChildViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; name = MailBoxTableChildViewController.m; path = Demo/ChildViewController/MailBoxTableChildViewController.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
78 | 285BE84418BEC5B300863AE4 /* MailBoxChildViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; name = MailBoxChildViewController.h; path = Demo/ChildViewController/MailBoxChildViewController.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
79 | 285BE84518BEC5B300863AE4 /* MailBoxChildViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; name = MailBoxChildViewController.m; path = Demo/ChildViewController/MailBoxChildViewController.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
80 | 28C0745519CB332B00D6ACA8 /* XLSegmentedSwipeContainerController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; name = XLSegmentedSwipeContainerController.h; path = XL/XLSegmentedSwipeContainerController.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
81 | 28C0745619CB332B00D6ACA8 /* XLSegmentedSwipeContainerController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; name = XLSegmentedSwipeContainerController.m; path = XL/XLSegmentedSwipeContainerController.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
82 | 28C0745819CB6BC800D6ACA8 /* Storyboard.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = Storyboard.storyboard; path = Demo/Storyboard.storyboard; sourceTree = ""; };
83 | 28C0745A19CB6F3600D6ACA8 /* BarContainerViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BarContainerViewController.h; path = Demo/BarContainerViewController.h; sourceTree = ""; };
84 | 28C0745B19CB6F3600D6ACA8 /* BarContainerViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = BarContainerViewController.m; path = Demo/BarContainerViewController.m; sourceTree = ""; };
85 | 28C0746419CCA13C00D6ACA8 /* XLBarSwipeContainerController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = XLBarSwipeContainerController.h; path = XL/XLBarSwipeContainerController.h; sourceTree = ""; };
86 | 28C0746519CCA13C00D6ACA8 /* XLBarSwipeContainerController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = XLBarSwipeContainerController.m; path = XL/XLBarSwipeContainerController.m; sourceTree = ""; };
87 | 28C0746719CCDFFC00D6ACA8 /* XLSwipeButtonBarView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = XLSwipeButtonBarView.h; path = XL/Views/XLSwipeButtonBarView.h; sourceTree = ""; };
88 | 28C0746819CCDFFC00D6ACA8 /* XLSwipeButtonBarView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = XLSwipeButtonBarView.m; path = XL/Views/XLSwipeButtonBarView.m; sourceTree = ""; };
89 | 28C0746A19CCF35B00D6ACA8 /* XLButtonBarSwipeContainerController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = XLButtonBarSwipeContainerController.h; path = XL/XLButtonBarSwipeContainerController.h; sourceTree = ""; };
90 | 28C0746B19CCF35B00D6ACA8 /* XLButtonBarSwipeContainerController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = XLButtonBarSwipeContainerController.m; path = XL/XLButtonBarSwipeContainerController.m; sourceTree = ""; };
91 | 28DA810519D8AC9200B7B2DB /* XLSwipeButtonBarViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = XLSwipeButtonBarViewCell.h; path = XL/Views/XLSwipeButtonBarViewCell.h; sourceTree = ""; };
92 | 28DA810619D8AC9200B7B2DB /* XLSwipeButtonBarViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = XLSwipeButtonBarViewCell.m; path = XL/Views/XLSwipeButtonBarViewCell.m; sourceTree = ""; };
93 | 28DA810819D8C58600B7B2DB /* ButtonContainerViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ButtonContainerViewController.h; path = Demo/ButtonContainerViewController.h; sourceTree = ""; };
94 | 28DA810919D8C58600B7B2DB /* ButtonContainerViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ButtonContainerViewController.m; path = Demo/ButtonContainerViewController.m; sourceTree = ""; };
95 | /* End PBXFileReference section */
96 |
97 | /* Begin PBXFrameworksBuildPhase section */
98 | 285BE7FD18BE20CA00863AE4 /* Frameworks */ = {
99 | isa = PBXFrameworksBuildPhase;
100 | buildActionMask = 2147483647;
101 | files = (
102 | 285BE80618BE20CA00863AE4 /* CoreGraphics.framework in Frameworks */,
103 | 285BE80818BE20CA00863AE4 /* UIKit.framework in Frameworks */,
104 | 285BE80418BE20CA00863AE4 /* Foundation.framework in Frameworks */,
105 | );
106 | runOnlyForDeploymentPostprocessing = 0;
107 | };
108 | 285BE81818BE20CA00863AE4 /* Frameworks */ = {
109 | isa = PBXFrameworksBuildPhase;
110 | buildActionMask = 2147483647;
111 | files = (
112 | 285BE81D18BE20CA00863AE4 /* XCTest.framework in Frameworks */,
113 | 285BE81F18BE20CA00863AE4 /* UIKit.framework in Frameworks */,
114 | 285BE81E18BE20CA00863AE4 /* Foundation.framework in Frameworks */,
115 | );
116 | runOnlyForDeploymentPostprocessing = 0;
117 | };
118 | /* End PBXFrameworksBuildPhase section */
119 |
120 | /* Begin PBXGroup section */
121 | 282ECBA319CDEAF700026184 /* ChildViewController */ = {
122 | isa = PBXGroup;
123 | children = (
124 | 285BE83E18BE278000863AE4 /* MailBoxTableChildViewController.h */,
125 | 285BE83F18BE278000863AE4 /* MailBoxTableChildViewController.m */,
126 | 285BE84418BEC5B300863AE4 /* MailBoxChildViewController.h */,
127 | 285BE84518BEC5B300863AE4 /* MailBoxChildViewController.m */,
128 | 282ECBAF19CDF40900026184 /* Views */,
129 | );
130 | name = ChildViewController;
131 | sourceTree = "";
132 | };
133 | 282ECBA719CDEC9A00026184 /* Helpers */ = {
134 | isa = PBXGroup;
135 | children = (
136 | 282ECBA919CDED3F00026184 /* XLJSONSerialization.h */,
137 | 282ECBAA19CDED3F00026184 /* XLJSONSerialization.m */,
138 | );
139 | name = Helpers;
140 | sourceTree = "";
141 | };
142 | 282ECBAF19CDF40900026184 /* Views */ = {
143 | isa = PBXGroup;
144 | children = (
145 | 282ECBB019CDF40900026184 /* PostCell.h */,
146 | 282ECBB119CDF40900026184 /* PostCell.m */,
147 | );
148 | name = Views;
149 | path = Demo/ChildViewController/Views;
150 | sourceTree = "";
151 | };
152 | 285BE7F718BE20CA00863AE4 = {
153 | isa = PBXGroup;
154 | children = (
155 | 285BE80918BE20CA00863AE4 /* XLMailBoxContainer */,
156 | 285BE82218BE20CA00863AE4 /* XLMailBoxContainerTests */,
157 | 285BE80218BE20CA00863AE4 /* Frameworks */,
158 | 285BE80118BE20CA00863AE4 /* Products */,
159 | );
160 | sourceTree = "";
161 | };
162 | 285BE80118BE20CA00863AE4 /* Products */ = {
163 | isa = PBXGroup;
164 | children = (
165 | 285BE80018BE20CA00863AE4 /* XLMailBoxContainer.app */,
166 | 285BE81B18BE20CA00863AE4 /* XLMailBoxContainerTests.xctest */,
167 | );
168 | name = Products;
169 | sourceTree = "";
170 | };
171 | 285BE80218BE20CA00863AE4 /* Frameworks */ = {
172 | isa = PBXGroup;
173 | children = (
174 | 285BE80318BE20CA00863AE4 /* Foundation.framework */,
175 | 285BE80518BE20CA00863AE4 /* CoreGraphics.framework */,
176 | 285BE80718BE20CA00863AE4 /* UIKit.framework */,
177 | 285BE81C18BE20CA00863AE4 /* XCTest.framework */,
178 | );
179 | name = Frameworks;
180 | sourceTree = "";
181 | };
182 | 285BE80918BE20CA00863AE4 /* XLMailBoxContainer */ = {
183 | isa = PBXGroup;
184 | children = (
185 | 285BE83D18BE271C00863AE4 /* Demo */,
186 | 285BE83218BE210100863AE4 /* XL */,
187 | 285BE81218BE20CA00863AE4 /* AppDelegate.h */,
188 | 285BE81318BE20CA00863AE4 /* AppDelegate.m */,
189 | 285BE81518BE20CA00863AE4 /* Images.xcassets */,
190 | 285BE80A18BE20CA00863AE4 /* Supporting Files */,
191 | );
192 | path = XLMailBoxContainer;
193 | sourceTree = "";
194 | };
195 | 285BE80A18BE20CA00863AE4 /* Supporting Files */ = {
196 | isa = PBXGroup;
197 | children = (
198 | 285BE80B18BE20CA00863AE4 /* XLMailBoxContainer-Info.plist */,
199 | 285BE80C18BE20CA00863AE4 /* InfoPlist.strings */,
200 | 285BE80F18BE20CA00863AE4 /* main.m */,
201 | 285BE81118BE20CA00863AE4 /* XLMailBoxContainer-Prefix.pch */,
202 | );
203 | name = "Supporting Files";
204 | sourceTree = "";
205 | };
206 | 285BE82218BE20CA00863AE4 /* XLMailBoxContainerTests */ = {
207 | isa = PBXGroup;
208 | children = (
209 | 285BE82818BE20CA00863AE4 /* XLMailBoxContainerTests.m */,
210 | 285BE82318BE20CA00863AE4 /* Supporting Files */,
211 | );
212 | path = XLMailBoxContainerTests;
213 | sourceTree = "";
214 | };
215 | 285BE82318BE20CA00863AE4 /* Supporting Files */ = {
216 | isa = PBXGroup;
217 | children = (
218 | 285BE82418BE20CA00863AE4 /* XLMailBoxContainerTests-Info.plist */,
219 | 285BE82518BE20CA00863AE4 /* InfoPlist.strings */,
220 | );
221 | name = "Supporting Files";
222 | sourceTree = "";
223 | };
224 | 285BE83218BE210100863AE4 /* XL */ = {
225 | isa = PBXGroup;
226 | children = (
227 | 28C0746019CC8A8100D6ACA8 /* Views */,
228 | 285BE83318BE24CE00863AE4 /* XLSwipeContainerController.h */,
229 | 285BE83418BE24CE00863AE4 /* XLSwipeContainerController.m */,
230 | 28C0745519CB332B00D6ACA8 /* XLSegmentedSwipeContainerController.h */,
231 | 28C0745619CB332B00D6ACA8 /* XLSegmentedSwipeContainerController.m */,
232 | 28C0746419CCA13C00D6ACA8 /* XLBarSwipeContainerController.h */,
233 | 28C0746519CCA13C00D6ACA8 /* XLBarSwipeContainerController.m */,
234 | 28C0746A19CCF35B00D6ACA8 /* XLButtonBarSwipeContainerController.h */,
235 | 28C0746B19CCF35B00D6ACA8 /* XLButtonBarSwipeContainerController.m */,
236 | );
237 | name = XL;
238 | sourceTree = "";
239 | };
240 | 285BE83D18BE271C00863AE4 /* Demo */ = {
241 | isa = PBXGroup;
242 | children = (
243 | 282ECBA719CDEC9A00026184 /* Helpers */,
244 | 282ECBA319CDEAF700026184 /* ChildViewController */,
245 | 28C0745819CB6BC800D6ACA8 /* Storyboard.storyboard */,
246 | 28C0745A19CB6F3600D6ACA8 /* BarContainerViewController.h */,
247 | 28C0745B19CB6F3600D6ACA8 /* BarContainerViewController.m */,
248 | 283BCCD119CFB77B0025E21D /* SegmentedContainerViewController.h */,
249 | 283BCCD219CFB77B0025E21D /* SegmentedContainerViewController.m */,
250 | 28DA810819D8C58600B7B2DB /* ButtonContainerViewController.h */,
251 | 28DA810919D8C58600B7B2DB /* ButtonContainerViewController.m */,
252 | );
253 | name = Demo;
254 | sourceTree = "";
255 | };
256 | 28C0746019CC8A8100D6ACA8 /* Views */ = {
257 | isa = PBXGroup;
258 | children = (
259 | 282ECBAC19CDED5B00026184 /* XLSwipeBarView.h */,
260 | 282ECBAD19CDED5B00026184 /* XLSwipeBarView.m */,
261 | 28C0746719CCDFFC00D6ACA8 /* XLSwipeButtonBarView.h */,
262 | 28C0746819CCDFFC00D6ACA8 /* XLSwipeButtonBarView.m */,
263 | 28DA810519D8AC9200B7B2DB /* XLSwipeButtonBarViewCell.h */,
264 | 28DA810619D8AC9200B7B2DB /* XLSwipeButtonBarViewCell.m */,
265 | );
266 | name = Views;
267 | sourceTree = "";
268 | };
269 | /* End PBXGroup section */
270 |
271 | /* Begin PBXNativeTarget section */
272 | 285BE7FF18BE20CA00863AE4 /* XLMailBoxContainer */ = {
273 | isa = PBXNativeTarget;
274 | buildConfigurationList = 285BE82C18BE20CA00863AE4 /* Build configuration list for PBXNativeTarget "XLMailBoxContainer" */;
275 | buildPhases = (
276 | 285BE7FC18BE20CA00863AE4 /* Sources */,
277 | 285BE7FD18BE20CA00863AE4 /* Frameworks */,
278 | 285BE7FE18BE20CA00863AE4 /* Resources */,
279 | );
280 | buildRules = (
281 | );
282 | dependencies = (
283 | );
284 | name = XLMailBoxContainer;
285 | productName = XLMailBoxContainer;
286 | productReference = 285BE80018BE20CA00863AE4 /* XLMailBoxContainer.app */;
287 | productType = "com.apple.product-type.application";
288 | };
289 | 285BE81A18BE20CA00863AE4 /* XLMailBoxContainerTests */ = {
290 | isa = PBXNativeTarget;
291 | buildConfigurationList = 285BE82F18BE20CA00863AE4 /* Build configuration list for PBXNativeTarget "XLMailBoxContainerTests" */;
292 | buildPhases = (
293 | 285BE81718BE20CA00863AE4 /* Sources */,
294 | 285BE81818BE20CA00863AE4 /* Frameworks */,
295 | 285BE81918BE20CA00863AE4 /* Resources */,
296 | );
297 | buildRules = (
298 | );
299 | dependencies = (
300 | 285BE82118BE20CA00863AE4 /* PBXTargetDependency */,
301 | );
302 | name = XLMailBoxContainerTests;
303 | productName = XLMailBoxContainerTests;
304 | productReference = 285BE81B18BE20CA00863AE4 /* XLMailBoxContainerTests.xctest */;
305 | productType = "com.apple.product-type.bundle.unit-test";
306 | };
307 | /* End PBXNativeTarget section */
308 |
309 | /* Begin PBXProject section */
310 | 285BE7F818BE20CA00863AE4 /* Project object */ = {
311 | isa = PBXProject;
312 | attributes = {
313 | LastUpgradeCheck = 0510;
314 | ORGANIZATIONNAME = Xmartlabs;
315 | TargetAttributes = {
316 | 285BE81A18BE20CA00863AE4 = {
317 | TestTargetID = 285BE7FF18BE20CA00863AE4;
318 | };
319 | };
320 | };
321 | buildConfigurationList = 285BE7FB18BE20CA00863AE4 /* Build configuration list for PBXProject "XLMailBoxContainer" */;
322 | compatibilityVersion = "Xcode 3.2";
323 | developmentRegion = English;
324 | hasScannedForEncodings = 0;
325 | knownRegions = (
326 | en,
327 | );
328 | mainGroup = 285BE7F718BE20CA00863AE4;
329 | productRefGroup = 285BE80118BE20CA00863AE4 /* Products */;
330 | projectDirPath = "";
331 | projectRoot = "";
332 | targets = (
333 | 285BE7FF18BE20CA00863AE4 /* XLMailBoxContainer */,
334 | 285BE81A18BE20CA00863AE4 /* XLMailBoxContainerTests */,
335 | );
336 | };
337 | /* End PBXProject section */
338 |
339 | /* Begin PBXResourcesBuildPhase section */
340 | 285BE7FE18BE20CA00863AE4 /* Resources */ = {
341 | isa = PBXResourcesBuildPhase;
342 | buildActionMask = 2147483647;
343 | files = (
344 | 285BE80E18BE20CA00863AE4 /* InfoPlist.strings in Resources */,
345 | 285BE81618BE20CA00863AE4 /* Images.xcassets in Resources */,
346 | 28C0745919CB6BC800D6ACA8 /* Storyboard.storyboard in Resources */,
347 | );
348 | runOnlyForDeploymentPostprocessing = 0;
349 | };
350 | 285BE81918BE20CA00863AE4 /* Resources */ = {
351 | isa = PBXResourcesBuildPhase;
352 | buildActionMask = 2147483647;
353 | files = (
354 | 285BE82718BE20CA00863AE4 /* InfoPlist.strings in Resources */,
355 | );
356 | runOnlyForDeploymentPostprocessing = 0;
357 | };
358 | /* End PBXResourcesBuildPhase section */
359 |
360 | /* Begin PBXSourcesBuildPhase section */
361 | 285BE7FC18BE20CA00863AE4 /* Sources */ = {
362 | isa = PBXSourcesBuildPhase;
363 | buildActionMask = 2147483647;
364 | files = (
365 | 28C0746C19CCF35B00D6ACA8 /* XLButtonBarSwipeContainerController.m in Sources */,
366 | 285BE84018BE278000863AE4 /* MailBoxTableChildViewController.m in Sources */,
367 | 28C0746619CCA13C00D6ACA8 /* XLBarSwipeContainerController.m in Sources */,
368 | 28C0746919CCDFFC00D6ACA8 /* XLSwipeButtonBarView.m in Sources */,
369 | 285BE83918BE24CE00863AE4 /* XLSwipeContainerController.m in Sources */,
370 | 28C0745719CB332B00D6ACA8 /* XLSegmentedSwipeContainerController.m in Sources */,
371 | 28C0745C19CB6F3600D6ACA8 /* BarContainerViewController.m in Sources */,
372 | 285BE81418BE20CA00863AE4 /* AppDelegate.m in Sources */,
373 | 28DA810A19D8C58600B7B2DB /* ButtonContainerViewController.m in Sources */,
374 | 285BE84618BEC5B300863AE4 /* MailBoxChildViewController.m in Sources */,
375 | 282ECBAE19CDED5B00026184 /* XLSwipeBarView.m in Sources */,
376 | 282ECBB219CDF40900026184 /* PostCell.m in Sources */,
377 | 282ECBAB19CDED3F00026184 /* XLJSONSerialization.m in Sources */,
378 | 285BE81018BE20CA00863AE4 /* main.m in Sources */,
379 | 28DA810719D8AC9200B7B2DB /* XLSwipeButtonBarViewCell.m in Sources */,
380 | 283BCCD319CFB77B0025E21D /* SegmentedContainerViewController.m in Sources */,
381 | );
382 | runOnlyForDeploymentPostprocessing = 0;
383 | };
384 | 285BE81718BE20CA00863AE4 /* Sources */ = {
385 | isa = PBXSourcesBuildPhase;
386 | buildActionMask = 2147483647;
387 | files = (
388 | 285BE82918BE20CA00863AE4 /* XLMailBoxContainerTests.m in Sources */,
389 | );
390 | runOnlyForDeploymentPostprocessing = 0;
391 | };
392 | /* End PBXSourcesBuildPhase section */
393 |
394 | /* Begin PBXTargetDependency section */
395 | 285BE82118BE20CA00863AE4 /* PBXTargetDependency */ = {
396 | isa = PBXTargetDependency;
397 | target = 285BE7FF18BE20CA00863AE4 /* XLMailBoxContainer */;
398 | targetProxy = 285BE82018BE20CA00863AE4 /* PBXContainerItemProxy */;
399 | };
400 | /* End PBXTargetDependency section */
401 |
402 | /* Begin PBXVariantGroup section */
403 | 285BE80C18BE20CA00863AE4 /* InfoPlist.strings */ = {
404 | isa = PBXVariantGroup;
405 | children = (
406 | 285BE80D18BE20CA00863AE4 /* en */,
407 | );
408 | name = InfoPlist.strings;
409 | sourceTree = "";
410 | };
411 | 285BE82518BE20CA00863AE4 /* InfoPlist.strings */ = {
412 | isa = PBXVariantGroup;
413 | children = (
414 | 285BE82618BE20CA00863AE4 /* en */,
415 | );
416 | name = InfoPlist.strings;
417 | sourceTree = "";
418 | };
419 | /* End PBXVariantGroup section */
420 |
421 | /* Begin XCBuildConfiguration section */
422 | 285BE82A18BE20CA00863AE4 /* Debug */ = {
423 | isa = XCBuildConfiguration;
424 | buildSettings = {
425 | ALWAYS_SEARCH_USER_PATHS = NO;
426 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
427 | CLANG_CXX_LIBRARY = "libc++";
428 | CLANG_ENABLE_MODULES = YES;
429 | CLANG_ENABLE_OBJC_ARC = YES;
430 | CLANG_WARN_BOOL_CONVERSION = YES;
431 | CLANG_WARN_CONSTANT_CONVERSION = YES;
432 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
433 | CLANG_WARN_EMPTY_BODY = YES;
434 | CLANG_WARN_ENUM_CONVERSION = YES;
435 | CLANG_WARN_INT_CONVERSION = YES;
436 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
437 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
438 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
439 | COPY_PHASE_STRIP = NO;
440 | GCC_C_LANGUAGE_STANDARD = gnu99;
441 | GCC_DYNAMIC_NO_PIC = NO;
442 | GCC_OPTIMIZATION_LEVEL = 0;
443 | GCC_PREPROCESSOR_DEFINITIONS = (
444 | "DEBUG=1",
445 | "$(inherited)",
446 | );
447 | GCC_SYMBOLS_PRIVATE_EXTERN = NO;
448 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
449 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
450 | GCC_WARN_UNDECLARED_SELECTOR = YES;
451 | GCC_WARN_UNINITIALIZED_AUTOS = YES;
452 | GCC_WARN_UNUSED_FUNCTION = YES;
453 | GCC_WARN_UNUSED_VARIABLE = YES;
454 | IPHONEOS_DEPLOYMENT_TARGET = 7.0;
455 | ONLY_ACTIVE_ARCH = YES;
456 | SDKROOT = iphoneos;
457 | };
458 | name = Debug;
459 | };
460 | 285BE82B18BE20CA00863AE4 /* Release */ = {
461 | isa = XCBuildConfiguration;
462 | buildSettings = {
463 | ALWAYS_SEARCH_USER_PATHS = NO;
464 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
465 | CLANG_CXX_LIBRARY = "libc++";
466 | CLANG_ENABLE_MODULES = YES;
467 | CLANG_ENABLE_OBJC_ARC = YES;
468 | CLANG_WARN_BOOL_CONVERSION = YES;
469 | CLANG_WARN_CONSTANT_CONVERSION = YES;
470 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
471 | CLANG_WARN_EMPTY_BODY = YES;
472 | CLANG_WARN_ENUM_CONVERSION = YES;
473 | CLANG_WARN_INT_CONVERSION = YES;
474 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
475 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
476 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
477 | COPY_PHASE_STRIP = YES;
478 | ENABLE_NS_ASSERTIONS = NO;
479 | GCC_C_LANGUAGE_STANDARD = gnu99;
480 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
481 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
482 | GCC_WARN_UNDECLARED_SELECTOR = YES;
483 | GCC_WARN_UNINITIALIZED_AUTOS = YES;
484 | GCC_WARN_UNUSED_FUNCTION = YES;
485 | GCC_WARN_UNUSED_VARIABLE = YES;
486 | IPHONEOS_DEPLOYMENT_TARGET = 7.0;
487 | SDKROOT = iphoneos;
488 | VALIDATE_PRODUCT = YES;
489 | };
490 | name = Release;
491 | };
492 | 285BE82D18BE20CA00863AE4 /* Debug */ = {
493 | isa = XCBuildConfiguration;
494 | buildSettings = {
495 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
496 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
497 | GCC_PRECOMPILE_PREFIX_HEADER = YES;
498 | GCC_PREFIX_HEADER = "XLMailBoxContainer/XLMailBoxContainer-Prefix.pch";
499 | INFOPLIST_FILE = "XLMailBoxContainer/XLMailBoxContainer-Info.plist";
500 | PRODUCT_NAME = "$(TARGET_NAME)";
501 | WRAPPER_EXTENSION = app;
502 | };
503 | name = Debug;
504 | };
505 | 285BE82E18BE20CA00863AE4 /* Release */ = {
506 | isa = XCBuildConfiguration;
507 | buildSettings = {
508 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
509 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
510 | GCC_PRECOMPILE_PREFIX_HEADER = YES;
511 | GCC_PREFIX_HEADER = "XLMailBoxContainer/XLMailBoxContainer-Prefix.pch";
512 | INFOPLIST_FILE = "XLMailBoxContainer/XLMailBoxContainer-Info.plist";
513 | PRODUCT_NAME = "$(TARGET_NAME)";
514 | WRAPPER_EXTENSION = app;
515 | };
516 | name = Release;
517 | };
518 | 285BE83018BE20CA00863AE4 /* Debug */ = {
519 | isa = XCBuildConfiguration;
520 | buildSettings = {
521 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/XLMailBoxContainer.app/XLMailBoxContainer";
522 | FRAMEWORK_SEARCH_PATHS = (
523 | "$(SDKROOT)/Developer/Library/Frameworks",
524 | "$(inherited)",
525 | "$(DEVELOPER_FRAMEWORKS_DIR)",
526 | );
527 | GCC_PRECOMPILE_PREFIX_HEADER = YES;
528 | GCC_PREFIX_HEADER = "XLMailBoxContainer/XLMailBoxContainer-Prefix.pch";
529 | GCC_PREPROCESSOR_DEFINITIONS = (
530 | "DEBUG=1",
531 | "$(inherited)",
532 | );
533 | INFOPLIST_FILE = "XLMailBoxContainerTests/XLMailBoxContainerTests-Info.plist";
534 | PRODUCT_NAME = "$(TARGET_NAME)";
535 | TEST_HOST = "$(BUNDLE_LOADER)";
536 | WRAPPER_EXTENSION = xctest;
537 | };
538 | name = Debug;
539 | };
540 | 285BE83118BE20CA00863AE4 /* Release */ = {
541 | isa = XCBuildConfiguration;
542 | buildSettings = {
543 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/XLMailBoxContainer.app/XLMailBoxContainer";
544 | FRAMEWORK_SEARCH_PATHS = (
545 | "$(SDKROOT)/Developer/Library/Frameworks",
546 | "$(inherited)",
547 | "$(DEVELOPER_FRAMEWORKS_DIR)",
548 | );
549 | GCC_PRECOMPILE_PREFIX_HEADER = YES;
550 | GCC_PREFIX_HEADER = "XLMailBoxContainer/XLMailBoxContainer-Prefix.pch";
551 | INFOPLIST_FILE = "XLMailBoxContainerTests/XLMailBoxContainerTests-Info.plist";
552 | PRODUCT_NAME = "$(TARGET_NAME)";
553 | TEST_HOST = "$(BUNDLE_LOADER)";
554 | WRAPPER_EXTENSION = xctest;
555 | };
556 | name = Release;
557 | };
558 | /* End XCBuildConfiguration section */
559 |
560 | /* Begin XCConfigurationList section */
561 | 285BE7FB18BE20CA00863AE4 /* Build configuration list for PBXProject "XLMailBoxContainer" */ = {
562 | isa = XCConfigurationList;
563 | buildConfigurations = (
564 | 285BE82A18BE20CA00863AE4 /* Debug */,
565 | 285BE82B18BE20CA00863AE4 /* Release */,
566 | );
567 | defaultConfigurationIsVisible = 0;
568 | defaultConfigurationName = Release;
569 | };
570 | 285BE82C18BE20CA00863AE4 /* Build configuration list for PBXNativeTarget "XLMailBoxContainer" */ = {
571 | isa = XCConfigurationList;
572 | buildConfigurations = (
573 | 285BE82D18BE20CA00863AE4 /* Debug */,
574 | 285BE82E18BE20CA00863AE4 /* Release */,
575 | );
576 | defaultConfigurationIsVisible = 0;
577 | defaultConfigurationName = Release;
578 | };
579 | 285BE82F18BE20CA00863AE4 /* Build configuration list for PBXNativeTarget "XLMailBoxContainerTests" */ = {
580 | isa = XCConfigurationList;
581 | buildConfigurations = (
582 | 285BE83018BE20CA00863AE4 /* Debug */,
583 | 285BE83118BE20CA00863AE4 /* Release */,
584 | );
585 | defaultConfigurationIsVisible = 0;
586 | defaultConfigurationName = Release;
587 | };
588 | /* End XCConfigurationList section */
589 | };
590 | rootObject = 285BE7F818BE20CA00863AE4 /* Project object */;
591 | }
592 |
--------------------------------------------------------------------------------
/XLMailBoxContainer.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/XLMailBoxContainer.xcodeproj/project.xcworkspace/xcuserdata/barreto.xcuserdatad/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | HasAskedToTakeAutomaticSnapshotBeforeSignificantChanges
6 |
7 | SnapshotAutomaticallyBeforeSignificantChanges
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/XLMailBoxContainer.xcodeproj/xcuserdata/barreto.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
8 |
14 |
15 |
16 |
18 |
30 |
31 |
32 |
34 |
46 |
47 |
48 |
50 |
62 |
63 |
64 |
66 |
78 |
79 |
80 |
82 |
94 |
95 |
96 |
98 |
110 |
111 |
112 |
114 |
126 |
127 |
128 |
130 |
142 |
143 |
144 |
146 |
158 |
159 |
160 |
162 |
174 |
175 |
176 |
178 |
190 |
191 |
192 |
193 |
194 |
--------------------------------------------------------------------------------
/XLMailBoxContainer.xcodeproj/xcuserdata/barreto.xcuserdatad/xcschemes/XLMailBoxContainer.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
33 |
39 |
40 |
41 |
42 |
43 |
49 |
50 |
51 |
52 |
61 |
62 |
68 |
69 |
70 |
71 |
72 |
73 |
79 |
80 |
86 |
87 |
88 |
89 |
91 |
92 |
95 |
96 |
97 |
--------------------------------------------------------------------------------
/XLMailBoxContainer.xcodeproj/xcuserdata/barreto.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | XLMailBoxContainer.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | 285BE7FF18BE20CA00863AE4
16 |
17 | primary
18 |
19 |
20 | 285BE81A18BE20CA00863AE4
21 |
22 | primary
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/XLMailBoxContainer/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // XLMailBoxContainer ( https://github.com/xmartlabs/XLMailBoxContainer )
4 | //
5 | // Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
6 | //
7 | //
8 | // Permission is hereby granted, free of charge, to any person obtaining a copy
9 | // of this software and associated documentation files (the "Software"), to deal
10 | // in the Software without restriction, including without limitation the rights
11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | // copies of the Software, and to permit persons to whom the Software is
13 | // furnished to do so, subject to the following conditions:
14 | //
15 | // The above copyright notice and this permission notice shall be included in
16 | // all copies or substantial portions of the Software.
17 | //
18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 | // THE SOFTWARE.
25 |
26 | #import
27 |
28 | @interface AppDelegate : UIResponder
29 |
30 | @property (strong, nonatomic) UIWindow *window;
31 |
32 | @end
33 |
--------------------------------------------------------------------------------
/XLMailBoxContainer/AppDelegate.m:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.m
3 | // XLMailBoxContainer ( https://github.com/xmartlabs/XLMailBoxContainer )
4 | //
5 | // Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
6 | //
7 | //
8 | // Permission is hereby granted, free of charge, to any person obtaining a copy
9 | // of this software and associated documentation files (the "Software"), to deal
10 | // in the Software without restriction, including without limitation the rights
11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | // copies of the Software, and to permit persons to whom the Software is
13 | // furnished to do so, subject to the following conditions:
14 | //
15 | // The above copyright notice and this permission notice shall be included in
16 | // all copies or substantial portions of the Software.
17 | //
18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 | // THE SOFTWARE.
25 |
26 | #import "XLJSONSerialization.h"
27 | #import "XLSegmentedSwipeContainerController.h"
28 | #import "MailBoxChildViewController.h"
29 | #import "MailBoxTableChildViewController.h"
30 |
31 | #import "AppDelegate.h"
32 |
33 | @implementation AppDelegate
34 |
35 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
36 | {
37 | [[XLJSONSerialization sharedInstance] postsData];
38 | // self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
39 | // // Override point for customization after application launch.
40 | // self.window.backgroundColor = [UIColor whiteColor];
41 | //
42 | // // create child view controllers that will be managed by XLSwipeContainerController
43 | // MailBoxTableChildViewController * child_1 = [[MailBoxTableChildViewController alloc] initWithStyle:UITableViewStylePlain];
44 | // MailBoxChildViewController * child_2 = [[MailBoxChildViewController alloc] init];
45 | // MailBoxTableChildViewController * child_3 = [[MailBoxTableChildViewController alloc] initWithStyle:UITableViewStyleGrouped];
46 | // MailBoxChildViewController * child_4 = [[MailBoxChildViewController alloc] init];
47 | // XLSwipeContainerController * swipeContainer = [[XLSegmentedSwipeContainerController alloc] initWithViewCurrentIndex:0 viewControllers:child_1, child_2, child_3, child_4, nil];
48 | // UINavigationController * navController = [[UINavigationController alloc] initWithRootViewController:swipeContainer];
49 | // self.window.rootViewController = navController;
50 | // [self.window makeKeyAndVisible];
51 | return YES;
52 |
53 | }
54 |
55 |
56 | @end
57 |
--------------------------------------------------------------------------------
/XLMailBoxContainer/Demo/BarContainerViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // BarContainerViewController.h
3 | // XLMailBoxContainer ( https://github.com/xmartlabs/XLMailBoxContainer )
4 | //
5 | // Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
6 | //
7 | //
8 | // Permission is hereby granted, free of charge, to any person obtaining a copy
9 | // of this software and associated documentation files (the "Software"), to deal
10 | // in the Software without restriction, including without limitation the rights
11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | // copies of the Software, and to permit persons to whom the Software is
13 | // furnished to do so, subject to the following conditions:
14 | //
15 | // The above copyright notice and this permission notice shall be included in
16 | // all copies or substantial portions of the Software.
17 | //
18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 | // THE SOFTWARE.
25 |
26 | #import "XLBarSwipeContainerController.h"
27 | #import "XLSwipeContainerController.h"
28 |
29 | @interface BarContainerViewController : XLBarSwipeContainerController
30 |
31 | @end
32 |
--------------------------------------------------------------------------------
/XLMailBoxContainer/Demo/BarContainerViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // BarContainerViewController.m
3 | // XLMailBoxContainer ( https://github.com/xmartlabs/XLMailBoxContainer )
4 | //
5 | // Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
6 | //
7 | //
8 | // Permission is hereby granted, free of charge, to any person obtaining a copy
9 | // of this software and associated documentation files (the "Software"), to deal
10 | // in the Software without restriction, including without limitation the rights
11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | // copies of the Software, and to permit persons to whom the Software is
13 | // furnished to do so, subject to the following conditions:
14 | //
15 | // The above copyright notice and this permission notice shall be included in
16 | // all copies or substantial portions of the Software.
17 | //
18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 | // THE SOFTWARE.
25 |
26 | #import "MailBoxTableChildViewController.h"
27 | #import "MailBoxChildViewController.h"
28 | #import "BarContainerViewController.h"
29 |
30 | @interface BarContainerViewController ()
31 | @end
32 |
33 | @implementation BarContainerViewController
34 | {
35 | NSArray * _swipeChildViewControllers;
36 | }
37 |
38 | - (instancetype)initWithCoder:(NSCoder *)coder
39 | {
40 | self = [super initWithCoder:coder];
41 | if (self) {
42 | }
43 | return self;
44 | }
45 |
46 |
47 |
48 | - (void)viewDidLoad
49 | {
50 | [super viewDidLoad];
51 | // Do any additional setup after loading the view.
52 | [self.swipeBar.selectedBar setBackgroundColor:[UIColor orangeColor]];
53 | }
54 |
55 | #pragma mark - XLSwipeContainerControllerDataSource
56 |
57 | -(NSArray *)swipeContainerControllerViewControllers:(XLSwipeContainerController *)swipeContainerController
58 | {
59 | if (_swipeChildViewControllers) return _swipeChildViewControllers;
60 | // create child view controllers that will be managed by XLSwipeContainerController
61 | MailBoxTableChildViewController * child_1 = [[MailBoxTableChildViewController alloc] initWithStyle:UITableViewStylePlain];
62 | MailBoxChildViewController * child_2 = [[MailBoxChildViewController alloc] init];
63 | MailBoxTableChildViewController * child_3 = [[MailBoxTableChildViewController alloc] initWithStyle:UITableViewStyleGrouped];
64 | MailBoxChildViewController * child_4 = [[MailBoxChildViewController alloc] init];
65 | _swipeChildViewControllers = @[child_1, child_2, child_3, child_4];
66 | return _swipeChildViewControllers;
67 | }
68 |
69 | @end
70 |
--------------------------------------------------------------------------------
/XLMailBoxContainer/Demo/ButtonContainerViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ButtonContainerViewController.h
3 | // XLMailBoxContainer ( https://github.com/xmartlabs/XLMailBoxContainer )
4 | //
5 | // Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
6 | //
7 | //
8 | // Permission is hereby granted, free of charge, to any person obtaining a copy
9 | // of this software and associated documentation files (the "Software"), to deal
10 | // in the Software without restriction, including without limitation the rights
11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | // copies of the Software, and to permit persons to whom the Software is
13 | // furnished to do so, subject to the following conditions:
14 | //
15 | // The above copyright notice and this permission notice shall be included in
16 | // all copies or substantial portions of the Software.
17 | //
18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 | // THE SOFTWARE.
25 |
26 | #import "XLButtonBarSwipeContainerController.h"
27 |
28 | @interface ButtonContainerViewController : XLButtonBarSwipeContainerController
29 |
30 | @end
31 |
--------------------------------------------------------------------------------
/XLMailBoxContainer/Demo/ButtonContainerViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // ButtonContainerViewController.m
3 | // XLMailBoxContainer ( https://github.com/xmartlabs/XLMailBoxContainer )
4 | //
5 | // Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
6 | //
7 | //
8 | // Permission is hereby granted, free of charge, to any person obtaining a copy
9 | // of this software and associated documentation files (the "Software"), to deal
10 | // in the Software without restriction, including without limitation the rights
11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | // copies of the Software, and to permit persons to whom the Software is
13 | // furnished to do so, subject to the following conditions:
14 | //
15 | // The above copyright notice and this permission notice shall be included in
16 | // all copies or substantial portions of the Software.
17 | //
18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 | // THE SOFTWARE.
25 |
26 | #import "MailBoxTableChildViewController.h"
27 | #import "MailBoxChildViewController.h"
28 | #import "ButtonContainerViewController.h"
29 |
30 | @interface ButtonContainerViewController ()
31 |
32 | @end
33 |
34 | @implementation ButtonContainerViewController
35 |
36 | - (void)viewDidLoad {
37 | [super viewDidLoad];
38 | // Do any additional setup after loading the view.
39 | [self.swipeBar.selectedBar setBackgroundColor:[UIColor orangeColor]];
40 | }
41 |
42 | #pragma mark - XLSwipeContainerControllerDataSource
43 |
44 | -(NSArray *)swipeContainerControllerViewControllers:(XLSwipeContainerController *)swipeContainerController
45 | {
46 | // create child view controllers that will be managed by XLSwipeContainerController
47 | MailBoxTableChildViewController * child_1 = [[MailBoxTableChildViewController alloc] initWithStyle:UITableViewStylePlain];
48 | MailBoxChildViewController * child_2 = [[MailBoxChildViewController alloc] init];
49 | MailBoxTableChildViewController * child_3 = [[MailBoxTableChildViewController alloc] initWithStyle:UITableViewStyleGrouped];
50 | MailBoxChildViewController * child_4 = [[MailBoxChildViewController alloc] init];
51 | MailBoxTableChildViewController * child_5 = [[MailBoxTableChildViewController alloc] initWithStyle:UITableViewStylePlain];
52 | MailBoxChildViewController * child_6 = [[MailBoxChildViewController alloc] init];
53 | MailBoxTableChildViewController * child_7 = [[MailBoxTableChildViewController alloc] initWithStyle:UITableViewStyleGrouped];
54 | MailBoxChildViewController * child_8 = [[MailBoxChildViewController alloc] init];
55 | return @[child_1, child_2, child_3, child_4, child_5, child_6, child_7, child_8];
56 | }
57 |
58 | @end
59 |
--------------------------------------------------------------------------------
/XLMailBoxContainer/Demo/ChildViewController/MailBoxChildViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // MailBoxChildViewController.h
3 | // XLMailBoxContainer ( https://github.com/xmartlabs/XLMailBoxContainer )
4 | //
5 | // Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
6 | //
7 | //
8 | // Permission is hereby granted, free of charge, to any person obtaining a copy
9 | // of this software and associated documentation files (the "Software"), to deal
10 | // in the Software without restriction, including without limitation the rights
11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | // copies of the Software, and to permit persons to whom the Software is
13 | // furnished to do so, subject to the following conditions:
14 | //
15 | // The above copyright notice and this permission notice shall be included in
16 | // all copies or substantial portions of the Software.
17 | //
18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 | // THE SOFTWARE.
25 |
26 | #import "XLSwipeContainerController.h"
27 | #import
28 |
29 | @interface MailBoxChildViewController : UIViewController
30 |
31 | @end
32 |
--------------------------------------------------------------------------------
/XLMailBoxContainer/Demo/ChildViewController/MailBoxChildViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // MailBoxChildViewController.m
3 | // XLMailBoxContainer ( https://github.com/xmartlabs/XLMailBoxContainer )
4 | //
5 | // Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
6 | //
7 | //
8 | // Permission is hereby granted, free of charge, to any person obtaining a copy
9 | // of this software and associated documentation files (the "Software"), to deal
10 | // in the Software without restriction, including without limitation the rights
11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | // copies of the Software, and to permit persons to whom the Software is
13 | // furnished to do so, subject to the following conditions:
14 | //
15 | // The above copyright notice and this permission notice shall be included in
16 | // all copies or substantial portions of the Software.
17 | //
18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 | // THE SOFTWARE.
25 |
26 | #import "MailBoxChildViewController.h"
27 |
28 | @implementation MailBoxChildViewController
29 |
30 | - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
31 | {
32 | self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
33 | if (self) {
34 | // Custom initialization
35 | }
36 | return self;
37 | }
38 |
39 | - (void)viewDidLoad
40 | {
41 | [super viewDidLoad];
42 | [self.view setBackgroundColor:[UIColor whiteColor]];
43 | // Do any additional setup after loading the view.
44 | UILabel * label = [[UILabel alloc] init];
45 | [label setTranslatesAutoresizingMaskIntoConstraints:NO];
46 | label.text = @"XLMailBoxContainer";
47 | [self.view addSubview:label];
48 |
49 |
50 | [self.view addConstraint:[NSLayoutConstraint constraintWithItem:label attribute:NSLayoutAttributeCenterX relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeCenterX multiplier:1.0 constant:0.0]];
51 | [self.view addConstraint:[NSLayoutConstraint constraintWithItem:label attribute:NSLayoutAttributeCenterY relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeCenterY multiplier:1.0 constant:0.0]];
52 | }
53 |
54 | -(void)viewWillAppear:(BOOL)animated
55 | {
56 | [super viewWillAppear:animated];
57 | }
58 |
59 |
60 | #pragma mark - XLSwipeContainerItemDelegate
61 |
62 | -(NSString *)nameForSwipeContainer:(XLSwipeContainerController *)swipeContainer
63 | {
64 | return @"View";
65 | }
66 |
67 | -(UIColor *)colorForSwipeContainer:(XLSwipeContainerController *)swipeContainer
68 | {
69 | return [UIColor whiteColor];
70 | }
71 |
72 | @end
73 |
--------------------------------------------------------------------------------
/XLMailBoxContainer/Demo/ChildViewController/MailBoxTableChildViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // MailBoxTableChildViewController.h
3 | // XLMailBoxContainer ( https://github.com/xmartlabs/XLMailBoxContainer )
4 | //
5 | // Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
6 | //
7 | //
8 | // Permission is hereby granted, free of charge, to any person obtaining a copy
9 | // of this software and associated documentation files (the "Software"), to deal
10 | // in the Software without restriction, including without limitation the rights
11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | // copies of the Software, and to permit persons to whom the Software is
13 | // furnished to do so, subject to the following conditions:
14 | //
15 | // The above copyright notice and this permission notice shall be included in
16 | // all copies or substantial portions of the Software.
17 | //
18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 | // THE SOFTWARE.
25 |
26 | #import
27 | #import "XLSwipeContainerController.h"
28 |
29 | @interface MailBoxTableChildViewController : UITableViewController
30 |
31 |
32 | @end
33 |
--------------------------------------------------------------------------------
/XLMailBoxContainer/Demo/ChildViewController/MailBoxTableChildViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // MailBoxTableChildViewController.m
3 | // XLMailBoxContainer ( https://github.com/xmartlabs/XLMailBoxContainer )
4 | //
5 | // Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
6 | //
7 | //
8 | // Permission is hereby granted, free of charge, to any person obtaining a copy
9 | // of this software and associated documentation files (the "Software"), to deal
10 | // in the Software without restriction, including without limitation the rights
11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | // copies of the Software, and to permit persons to whom the Software is
13 | // furnished to do so, subject to the following conditions:
14 | //
15 | // The above copyright notice and this permission notice shall be included in
16 | // all copies or substantial portions of the Software.
17 | //
18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 | // THE SOFTWARE.
25 |
26 | #import "XLJSONSerialization.h"
27 | #import "PostCell.h"
28 | #import "MailBoxTableChildViewController.h"
29 |
30 | NSString *const kCellIdentifier = @"PostCell";
31 |
32 | @implementation MailBoxTableChildViewController
33 | {
34 | NSArray * _posts;
35 | PostCell * _offScreenCell;
36 | }
37 |
38 | - (id)initWithStyle:(UITableViewStyle)style
39 | {
40 | self = [super initWithStyle:style];
41 | if (self) {
42 | _posts = [[XLJSONSerialization sharedInstance] postsData];
43 | }
44 | return self;
45 | }
46 |
47 | - (void)viewDidLoad
48 | {
49 | [super viewDidLoad];
50 | [self.tableView registerClass:[PostCell class] forCellReuseIdentifier:kCellIdentifier];
51 | }
52 |
53 |
54 | -(void)viewWillAppear:(BOOL)animated
55 | {
56 | [super viewWillAppear:animated];
57 | }
58 |
59 | #pragma mark - Table view data source
60 |
61 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
62 | {
63 | return 1;
64 | }
65 |
66 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
67 | {
68 | return _posts.count;
69 | }
70 |
71 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
72 | {
73 | PostCell *cell = (PostCell *) [tableView dequeueReusableCellWithIdentifier:kCellIdentifier forIndexPath:indexPath];
74 |
75 | cell.userName.text = [_posts objectAtIndex:indexPath.row][@"post"][@"user"][@"name"];
76 | cell.postDate.text = [self timeAgo:[self dateFromString:[_posts objectAtIndex:indexPath.row][@"post"][@"created_at"]]];
77 | cell.postText.text = [_posts objectAtIndex:indexPath.row][@"post"][@"text"];
78 | [cell.postText setPreferredMaxLayoutWidth:self.view.bounds.size.width];
79 | [cell.userImage setImage:[UIImage imageNamed:[cell.userName.text stringByReplacingOccurrencesOfString:@" " withString:@"_"]]];
80 | return cell;
81 | }
82 |
83 | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
84 | {
85 | if (!_offScreenCell)
86 | {
87 | _offScreenCell = (PostCell *)[self.tableView dequeueReusableCellWithIdentifier:kCellIdentifier];
88 | // Dummy Data
89 | _offScreenCell.userName.text = @"offscreen name";
90 | _offScreenCell.postDate.text = @"7m";
91 | [_offScreenCell.userImage setImage:[UIImage imageNamed:@"default-avatar"]];
92 | }
93 | _offScreenCell.postText.text = [_posts objectAtIndex:indexPath.row][@"post"][@"text"];
94 | [_offScreenCell.postText setPreferredMaxLayoutWidth:self.view.bounds.size.width];
95 | [_offScreenCell.contentView setNeedsLayout];
96 | [_offScreenCell.contentView layoutIfNeeded];
97 | CGSize size = [_offScreenCell.contentView systemLayoutSizeFittingSize:UILayoutFittingCompressedSize];
98 | return size.height + 1;
99 | }
100 |
101 | #pragma mark - XLSwipeContainerItemDelegate
102 |
103 | -(NSString *)nameForSwipeContainer:(XLSwipeContainerController *)swipeContainer
104 | {
105 | return @"Table View";
106 | }
107 |
108 | -(UIColor *)colorForSwipeContainer:(XLSwipeContainerController *)swipeContainer
109 | {
110 | return [UIColor whiteColor];
111 | }
112 |
113 |
114 | #pragma mark - Helpers
115 |
116 | #define SECONDS_IN_A_MINUTE 60
117 | #define SECONDS_IN_A_HOUR 3600
118 | #define SECONDS_IN_A_DAY 86400
119 | #define SECONDS_IN_A_MONTH_OF_30_DAYS 2592000
120 | #define SECONDS_IN_A_YEAR_OF_MONTH_OF_30_DAYS 31104000
121 |
122 | - (NSString *)timeAgo:(NSDate *)date {
123 | NSTimeInterval distanceBetweenDates = [date timeIntervalSinceDate:[NSDate date]] * (-1);
124 | int distance = (int)floorf(distanceBetweenDates);
125 | if (distance <= 0) {
126 | return @"now";
127 | }
128 | else if (distance < SECONDS_IN_A_MINUTE) {
129 | return [NSString stringWithFormat:@"%ds", distance];
130 | }
131 | else if (distance < SECONDS_IN_A_HOUR) {
132 | distance = distance / SECONDS_IN_A_MINUTE;
133 | return [NSString stringWithFormat:@"%dm", distance];
134 | }
135 | else if (distance < SECONDS_IN_A_DAY) {
136 | distance = distance / SECONDS_IN_A_HOUR;
137 | return [NSString stringWithFormat:@"%dh", distance];
138 | }
139 | else if (distance < SECONDS_IN_A_MONTH_OF_30_DAYS) {
140 | distance = distance / SECONDS_IN_A_DAY;
141 | return [NSString stringWithFormat:@"%dd", distance];
142 | }
143 | else if (distance < SECONDS_IN_A_YEAR_OF_MONTH_OF_30_DAYS) {
144 | distance = distance / SECONDS_IN_A_MONTH_OF_30_DAYS;
145 | return [NSString stringWithFormat:@"%dmo", distance];
146 | } else {
147 | distance = distance / SECONDS_IN_A_YEAR_OF_MONTH_OF_30_DAYS;
148 | return [NSString stringWithFormat:@"%dy", distance];
149 | }
150 | }
151 |
152 | -(NSDate *)dateFromString:(NSString *)dateString
153 | {
154 | // date formatter
155 | NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
156 | [formatter setTimeZone:[NSTimeZone timeZoneWithName:@"UTC"]];
157 | [formatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ss"];
158 | // hot fix from date
159 | NSRange range = [dateString rangeOfString:@"."];
160 | if (range.location != NSNotFound){
161 | dateString = [dateString substringToIndex:range.location];
162 | }
163 | return [formatter dateFromString:dateString];
164 | }
165 |
166 |
167 | @end
168 |
--------------------------------------------------------------------------------
/XLMailBoxContainer/Demo/ChildViewController/Views/PostCell.h:
--------------------------------------------------------------------------------
1 | //
2 | // PostCell.h
3 | // XLMailBoxContainer ( https://github.com/xmartlabs/XLMailBoxContainer )
4 | //
5 | // Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
6 | //
7 | //
8 | // Permission is hereby granted, free of charge, to any person obtaining a copy
9 | // of this software and associated documentation files (the "Software"), to deal
10 | // in the Software without restriction, including without limitation the rights
11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | // copies of the Software, and to permit persons to whom the Software is
13 | // furnished to do so, subject to the following conditions:
14 | //
15 | // The above copyright notice and this permission notice shall be included in
16 | // all copies or substantial portions of the Software.
17 | //
18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 | // THE SOFTWARE.
25 |
26 | #import
27 |
28 |
29 | @interface PostTextLabel : UILabel
30 | @end
31 |
32 |
33 | @interface PostCell : UITableViewCell
34 |
35 | @property (nonatomic) UIImageView * userImage;
36 | @property (nonatomic) UILabel * userName;
37 | @property (nonatomic) PostTextLabel * postText;
38 | @property (nonatomic) UILabel * postDate;
39 |
40 | @end
41 |
--------------------------------------------------------------------------------
/XLMailBoxContainer/Demo/ChildViewController/Views/PostCell.m:
--------------------------------------------------------------------------------
1 | //
2 | // PostCell.m
3 | // XLMailBoxContainer ( https://github.com/xmartlabs/XLMailBoxContainer )
4 | //
5 | // Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
6 | //
7 | //
8 | // Permission is hereby granted, free of charge, to any person obtaining a copy
9 | // of this software and associated documentation files (the "Software"), to deal
10 | // in the Software without restriction, including without limitation the rights
11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | // copies of the Software, and to permit persons to whom the Software is
13 | // furnished to do so, subject to the following conditions:
14 | //
15 | // The above copyright notice and this permission notice shall be included in
16 | // all copies or substantial portions of the Software.
17 | //
18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 | // THE SOFTWARE.
25 |
26 | #import "PostCell.h"
27 |
28 | @implementation PostCell
29 |
30 | @synthesize userImage = _userImage;
31 | @synthesize userName = _userName;
32 | @synthesize postText = _postText;
33 | @synthesize postDate = _postDate;
34 |
35 | - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
36 | {
37 | self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
38 | if (self) {
39 | // Initialization code
40 |
41 | [self.contentView addSubview:self.userImage];
42 | [self.contentView addSubview:self.userName];
43 | [self.contentView addSubview:self.postText];
44 | [self.contentView addSubview:self.postDate];
45 |
46 | [self.contentView addConstraints:[self layoutConstraints]];
47 | }
48 | return self;
49 | }
50 |
51 | #pragma mark - Views
52 |
53 | -(UIImageView *)userImage
54 | {
55 | if (_userImage) return _userImage;
56 | _userImage = [UIImageView new];
57 | [_userImage setTranslatesAutoresizingMaskIntoConstraints:NO];
58 | _userImage.layer.masksToBounds = YES;
59 | _userImage.layer.cornerRadius = 10.0f;
60 | return _userImage;
61 | }
62 |
63 | -(UILabel *)userName
64 | {
65 | if (_userName) return _userName;
66 | _userName = [UILabel new];
67 | [_userName setTranslatesAutoresizingMaskIntoConstraints:NO];
68 | _userName.font = [UIFont fontWithName:@"HelveticaNeue" size:15];
69 | [_userName setContentCompressionResistancePriority:500 forAxis:UILayoutConstraintAxisHorizontal];
70 |
71 | return _userName;
72 | }
73 |
74 | -(PostTextLabel *)postText
75 | {
76 | if (_postText) return _postText;
77 | _postText = [PostTextLabel new];
78 | [_postText setTranslatesAutoresizingMaskIntoConstraints:NO];
79 | _postText.font = [UIFont fontWithName:@"HelveticaNeue" size:12];
80 |
81 | _postText.lineBreakMode = NSLineBreakByWordWrapping;
82 | _postText.numberOfLines = 0;
83 |
84 | return _postText;
85 | }
86 |
87 | -(UILabel *)postDate
88 | {
89 | if (_postDate) return _postDate;
90 | _postDate = [UILabel new];
91 | [_postDate setTranslatesAutoresizingMaskIntoConstraints:NO];
92 | _postDate.textColor = [UIColor grayColor];
93 | _postDate.font = [UIFont fontWithName:@"HelveticaNeue" size:12];
94 | [_postDate setTextAlignment:NSTextAlignmentRight];
95 | return _postDate;
96 | }
97 |
98 |
99 | #pragma mark - Layout Constraints
100 |
101 | -(NSArray *)layoutConstraints{
102 |
103 | NSMutableArray * result = [NSMutableArray array];
104 |
105 | NSDictionary * views = @{ @"image": self.userImage,
106 | @"name": self.userName,
107 | @"text": self.postText,
108 | @"date" : self.postDate };
109 |
110 | NSDictionary *metrics = @{@"imgSize":@50.0,
111 | @"margin" :@12.0};
112 |
113 | [result addObjectsFromArray:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-(margin)-[image(imgSize)]-[name]"
114 | options:NSLayoutFormatAlignAllTop
115 | metrics:metrics
116 | views:views]];
117 |
118 | [result addObjectsFromArray:[NSLayoutConstraint constraintsWithVisualFormat:@"H:[name]-[date]-20-|"
119 | options:NSLayoutFormatAlignAllBaseline
120 | metrics:metrics
121 | views:views]];
122 |
123 | [result addObjectsFromArray:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-(margin)-[image(imgSize)]"
124 | options:0
125 | metrics:metrics
126 | views:views]];
127 |
128 | [result addObjectsFromArray:[NSLayoutConstraint constraintsWithVisualFormat:@"V:[name]-[text]-20-|"
129 | options:NSLayoutFormatAlignAllLeft
130 | metrics:metrics
131 | views:views]];
132 |
133 | [result addObjectsFromArray:[NSLayoutConstraint constraintsWithVisualFormat:@"H:[text]-20-|"
134 | options:NSLayoutFormatAlignAllBaseline
135 | metrics:metrics
136 | views:views]];
137 | return result;
138 | }
139 |
140 | @end
141 |
142 |
143 | @implementation PostTextLabel
144 |
145 | - (id)initWithFrame:(CGRect)frame
146 | {
147 | self = [super initWithFrame:frame];
148 | if (self) {
149 | // Initialization code
150 | }
151 | return self;
152 | }
153 |
154 | - (void) layoutSubviews {
155 | [super layoutSubviews];
156 | self.preferredMaxLayoutWidth = self.bounds.size.width;
157 | }
158 |
159 | @end
160 |
--------------------------------------------------------------------------------
/XLMailBoxContainer/Demo/Helpers/XLJSONSerialization.h:
--------------------------------------------------------------------------------
1 | //
2 | // XLJSONSerialization.h
3 | // XLMailBoxContainer ( https://github.com/xmartlabs/XLMailBoxContainer )
4 | //
5 | // Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
6 | //
7 | //
8 | // Permission is hereby granted, free of charge, to any person obtaining a copy
9 | // of this software and associated documentation files (the "Software"), to deal
10 | // in the Software without restriction, including without limitation the rights
11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | // copies of the Software, and to permit persons to whom the Software is
13 | // furnished to do so, subject to the following conditions:
14 | //
15 | // The above copyright notice and this permission notice shall be included in
16 | // all copies or substantial portions of the Software.
17 | //
18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 | // THE SOFTWARE.
25 |
26 | #import
27 |
28 | @interface XLJSONSerialization : NSObject
29 |
30 | + (instancetype)sharedInstance;
31 |
32 | @property (readonly) NSArray * postsData;
33 |
34 | @end
35 |
--------------------------------------------------------------------------------
/XLMailBoxContainer/Demo/Helpers/XLJSONSerialization.m:
--------------------------------------------------------------------------------
1 | //
2 | // XLJSONSerialization.m
3 | // XLMailBoxContainer ( https://github.com/xmartlabs/XLMailBoxContainer )
4 | //
5 | // Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
6 | //
7 | //
8 | // Permission is hereby granted, free of charge, to any person obtaining a copy
9 | // of this software and associated documentation files (the "Software"), to deal
10 | // in the Software without restriction, including without limitation the rights
11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | // copies of the Software, and to permit persons to whom the Software is
13 | // furnished to do so, subject to the following conditions:
14 | //
15 | // The above copyright notice and this permission notice shall be included in
16 | // all copies or substantial portions of the Software.
17 | //
18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 | // THE SOFTWARE.
25 |
26 | #import "XLJSONSerialization.h"
27 |
28 | @implementation XLJSONSerialization
29 |
30 |
31 | @synthesize postsData = _postData;
32 |
33 | + (instancetype)sharedInstance
34 | {
35 | static XLJSONSerialization * _sharedInstance = nil;
36 | static dispatch_once_t onceToken;
37 |
38 | dispatch_once(&onceToken, ^{
39 | _sharedInstance = [[self alloc] init];
40 |
41 | });
42 | return _sharedInstance;
43 | }
44 |
45 | -(NSArray *)postsData
46 | {
47 | if (_postData){
48 | return _postData;
49 | }
50 | NSString * jsonStr = @"[{\"post\":{\"id\":113,\"text\":\"We're getting fifty percent of the t-shirt sales\",\"created_at\":\"2014-04-17T00:45:40.556Z\",\"user\":{\"id\":9,\"name\":\"Lisa Simpsons\",\"imageURL\":\"http://obscure-refuge-3149.herokuapp.com/images/Lisa_Simpsons.png\"}}},{\"post\":{\"id\":66,\"text\":\"Eep!\",\"created_at\":\"2014-04-09T21:29:59.982Z\",\"user\":{\"id\":7,\"name\":\"Bart Simpsons\",\"imageURL\":\"http://obscure-refuge-3149.herokuapp.com/images/Bart_Simpsons.png\"}}},{\"post\":{\"id\":42,\"text\":\"I'm not thinking straight, why did I have that wine cooler last month?\",\"created_at\":\"2014-04-09T17:58:41.704Z\",\"user\":{\"id\":5,\"name\":\"Ned Flanders\",\"imageURL\":\"http://obscure-refuge-3149.herokuapp.com/images/Ned_Flanders.png\"}}},{\"post\":{\"id\":84,\"text\":\"Son, when you participate in sporting events, it's not whether you win or lose: it's how drunk you get.\",\"created_at\":\"2014-04-03T20:21:32.119Z\",\"user\":{\"id\":8,\"name\":\"Homer Simpsons\",\"imageURL\":\"http://obscure-refuge-3149.herokuapp.com/images/Homer_Simpsons.png\"}}},{\"post\":{\"id\":75,\"text\":\"I'm normally not a praying man, but if you're up there, please save me Superman.\",\"created_at\":\"2014-04-03T02:04:43.053Z\",\"user\":{\"id\":8,\"name\":\"Homer Simpsons\",\"imageURL\":\"http://obscure-refuge-3149.herokuapp.com/images/Homer_Simpsons.png\"}}},{\"post\":{\"id\":26,\"text\":\"Homer, please get rid of that pig.\",\"created_at\":\"2014-04-02T03:48:56.381Z\",\"user\":{\"id\":3,\"name\":\"Marge Simpsons\",\"imageURL\":\"http://obscure-refuge-3149.herokuapp.com/images/Marge_Simpsons.png\"}}},{\"post\":{\"id\":40,\"text\":\"You sold weapon-grade plutoneum to the Iraqies without a mark up.\",\"created_at\":\"2014-03-28T05:23:24.657Z\",\"user\":{\"id\":4,\"name\":\"Montgomery Burns\",\"imageURL\":\"http://obscure-refuge-3149.herokuapp.com/images/Montgomery_Burns.png\"}}},{\"post\":{\"id\":28,\"text\":\"Homer, don't say that. The way I see it, if you raised three children who can knock out and hog tie a perfect stranger you must be doing something right.\",\"created_at\":\"2014-03-22T14:24:22.408Z\",\"user\":{\"id\":3,\"name\":\"Marge Simpsons\",\"imageURL\":\"http://obscure-refuge-3149.herokuapp.com/images/Marge_Simpsons.png\"}}},{\"post\":{\"id\":48,\"text\":\"Hi-dilly-ho, neighborinos!\",\"created_at\":\"2014-03-21T08:39:20.764Z\",\"user\":{\"id\":5,\"name\":\"Ned Flanders\",\"imageURL\":\"http://obscure-refuge-3149.herokuapp.com/images/Ned_Flanders.png\"}}},{\"post\":{\"id\":78,\"text\":\"Maybe, just once, someone will call me 'Sir' without adding, 'You're making a scene.'\",\"created_at\":\"2014-03-20T02:44:28.075Z\",\"user\":{\"id\":8,\"name\":\"Homer Simpsons\",\"imageURL\":\"http://obscure-refuge-3149.herokuapp.com/images/Homer_Simpsons.png\"}}},{\"post\":{\"id\":33,\"text\":\"This is the type of trickery I pay you for.\",\"created_at\":\"2014-03-18T08:25:14.507Z\",\"user\":{\"id\":4,\"name\":\"Montgomery Burns\",\"imageURL\":\"http://obscure-refuge-3149.herokuapp.com/images/Montgomery_Burns.png\"}}},{\"post\":{\"id\":72,\"text\":\"Oh, so they have internet on computers now!\",\"created_at\":\"2014-03-03T19:02:56.032Z\",\"user\":{\"id\":8,\"name\":\"Homer Simpsons\",\"imageURL\":\"http://obscure-refuge-3149.herokuapp.com/images/Homer_Simpsons.png\"}}},{\"post\":{\"id\":1,\"text\":\"You know, I do! I mean, there comes a time in a man's life when he asks himself, 'who will float my corpse down the Ganges?'\",\"created_at\":\"2014-02-24T14:09:00.912Z\",\"user\":{\"id\":1,\"name\":\"Apu Nahasapeemapetilon\",\"imageURL\":\"http://obscure-refuge-3149.herokuapp.com/images/Apu_Nahasapeemapetilon.png\"}}},{\"post\":{\"id\":62,\"text\":\"Ay Caramba!\",\"created_at\":\"2014-02-18T16:38:37.958Z\",\"user\":{\"id\":7,\"name\":\"Bart Simpsons\",\"imageURL\":\"http://obscure-refuge-3149.herokuapp.com/images/Bart_Simpsons.png\"}}},{\"post\":{\"id\":19,\"text\":\"Throughout the ages, the finger painter, the Play-Doh sculptor, the Lincoln Logger, stood alone against the daycare teacher of her time. She did not live to earn aproval stickers, she lived for herself, that she might achieve things that are the glory of all humanity. These are my terms. I do not care to play by any others. And now, if the jury will allow me, it's naptime.\",\"created_at\":\"2014-02-16T22:11:33.236Z\",\"user\":{\"id\":2,\"name\":\"Maggie Simpsons\",\"imageURL\":\"http://obscure-refuge-3149.herokuapp.com/images/Maggie_Simpsons.png\"}}},{\"post\":{\"id\":76,\"text\":\"Son, if you really want something in this life, you have to work for it. Now quiet! They're about to announce the lottery numbers.\",\"created_at\":\"2014-02-16T19:09:55.062Z\",\"user\":{\"id\":8,\"name\":\"Homer Simpsons\",\"imageURL\":\"http://obscure-refuge-3149.herokuapp.com/images/Homer_Simpsons.png\"}}},{\"post\":{\"id\":22,\"text\":\"Somebody throw the goddamn bomb!\",\"created_at\":\"2014-02-16T13:50:25.313Z\",\"user\":{\"id\":3,\"name\":\"Marge Simpsons\",\"imageURL\":\"http://obscure-refuge-3149.herokuapp.com/images/Marge_Simpsons.png\"}}},{\"post\":{\"id\":36,\"text\":\"Oh, so mother nature needs a favor? Well, maybe she should have thought of that when she was besetting us with droughts and floods and poison monkeys.\",\"created_at\":\"2014-02-13T06:51:57.549Z\",\"user\":{\"id\":4,\"name\":\"Montgomery Burns\",\"imageURL\":\"http://obscure-refuge-3149.herokuapp.com/images/Montgomery_Burns.png\"}}}]";
51 |
52 | NSData * jsonData = [jsonStr dataUsingEncoding:NSUTF8StringEncoding];
53 |
54 | return [NSJSONSerialization JSONObjectWithData:jsonData options:0 error:nil];
55 | }
56 |
57 | @end
58 |
--------------------------------------------------------------------------------
/XLMailBoxContainer/Demo/SegmentedContainerViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // SegmentedContainerViewController.h
3 | // XLMailBoxContainer ( https://github.com/xmartlabs/XLMailBoxContainer )
4 | //
5 | // Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
6 | //
7 | //
8 | // Permission is hereby granted, free of charge, to any person obtaining a copy
9 | // of this software and associated documentation files (the "Software"), to deal
10 | // in the Software without restriction, including without limitation the rights
11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | // copies of the Software, and to permit persons to whom the Software is
13 | // furnished to do so, subject to the following conditions:
14 | //
15 | // The above copyright notice and this permission notice shall be included in
16 | // all copies or substantial portions of the Software.
17 | //
18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 | // THE SOFTWARE.
25 |
26 | #import "XLSegmentedSwipeContainerController.h"
27 |
28 | @interface SegmentedContainerViewController : XLSegmentedSwipeContainerController
29 |
30 | @end
31 |
--------------------------------------------------------------------------------
/XLMailBoxContainer/Demo/SegmentedContainerViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // SegmentedContainerViewController.m
3 | // XLMailBoxContainer ( https://github.com/xmartlabs/XLMailBoxContainer )
4 | //
5 | // Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
6 | //
7 | //
8 | // Permission is hereby granted, free of charge, to any person obtaining a copy
9 | // of this software and associated documentation files (the "Software"), to deal
10 | // in the Software without restriction, including without limitation the rights
11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | // copies of the Software, and to permit persons to whom the Software is
13 | // furnished to do so, subject to the following conditions:
14 | //
15 | // The above copyright notice and this permission notice shall be included in
16 | // all copies or substantial portions of the Software.
17 | //
18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 | // THE SOFTWARE.
25 |
26 | #import "MailBoxChildViewController.h"
27 | #import "MailBoxTableChildViewController.h"
28 | #import "SegmentedContainerViewController.h"
29 |
30 | @interface SegmentedContainerViewController ()
31 |
32 | @end
33 |
34 | @implementation SegmentedContainerViewController
35 |
36 |
37 | - (instancetype)initWithCoder:(NSCoder *)coder
38 | {
39 | self = [super initWithCoder:coder];
40 | if (self) {
41 | self.skipIntermediateViewControllers = NO;
42 | }
43 | return self;
44 | }
45 |
46 | #pragma mark - XLSwipe
47 |
48 | -(NSArray *)swipeContainerControllerViewControllers:(XLSwipeContainerController *)swipeContainerController
49 | {
50 | // create child view controllers that will be managed by XLSwipeContainerController
51 | MailBoxTableChildViewController * child_1 = [[MailBoxTableChildViewController alloc] initWithStyle:UITableViewStylePlain];
52 | MailBoxChildViewController * child_2 = [[MailBoxChildViewController alloc] init];
53 | MailBoxTableChildViewController * child_3 = [[MailBoxTableChildViewController alloc] initWithStyle:UITableViewStyleGrouped];
54 | MailBoxChildViewController * child_4 = [[MailBoxChildViewController alloc] init];
55 | return @[child_1, child_2, child_3, child_4];
56 | }
57 |
58 |
59 | @end
60 |
--------------------------------------------------------------------------------
/XLMailBoxContainer/Demo/Storyboard.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
216 |
217 |
218 |
219 |
220 |
221 |
222 |
223 |
224 |
225 |
226 |
227 |
228 |
229 |
230 |
231 |
232 |
233 |
234 |
235 |
236 |
237 |
238 |
239 |
240 |
241 |
242 |
243 |
244 |
245 |
246 |
247 |
248 |
249 |
250 |
251 |
252 |
253 |
254 |
255 |
256 |
257 |
258 |
259 |
260 |
261 |
262 |
263 |
264 |
265 |
266 |
267 |
268 |
269 |
270 |
271 |
272 |
278 |
279 |
280 |
281 |
282 |
283 |
284 |
285 |
286 |
287 |
288 |
289 |
290 |
291 |
292 |
293 |
294 |
295 |
296 |
297 |
298 |
299 |
300 |
301 |
302 |
303 |
304 |
305 |
306 |
307 |
308 |
309 |
310 |
311 |
312 |
313 |
314 |
315 |
316 |
317 |
318 |
319 |
320 |
321 |
322 |
323 |
324 |
--------------------------------------------------------------------------------
/XLMailBoxContainer/Images.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "size" : "29x29",
5 | "idiom" : "iphone",
6 | "filename" : "xl_appicon_58.png",
7 | "scale" : "2x"
8 | },
9 | {
10 | "size" : "40x40",
11 | "idiom" : "iphone",
12 | "filename" : "xl_appicon_80.png",
13 | "scale" : "2x"
14 | },
15 | {
16 | "size" : "60x60",
17 | "idiom" : "iphone",
18 | "filename" : "xl_appicon_120.png",
19 | "scale" : "2x"
20 | }
21 | ],
22 | "info" : {
23 | "version" : 1,
24 | "author" : "xcode"
25 | }
26 | }
--------------------------------------------------------------------------------
/XLMailBoxContainer/Images.xcassets/AppIcon.appiconset/xl_appicon_120.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xmartlabs/XLMailBoxContainer/2c2ca7e59f380aad3ba48ebc1960e97975e5702e/XLMailBoxContainer/Images.xcassets/AppIcon.appiconset/xl_appicon_120.png
--------------------------------------------------------------------------------
/XLMailBoxContainer/Images.xcassets/AppIcon.appiconset/xl_appicon_58.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xmartlabs/XLMailBoxContainer/2c2ca7e59f380aad3ba48ebc1960e97975e5702e/XLMailBoxContainer/Images.xcassets/AppIcon.appiconset/xl_appicon_58.png
--------------------------------------------------------------------------------
/XLMailBoxContainer/Images.xcassets/AppIcon.appiconset/xl_appicon_80.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xmartlabs/XLMailBoxContainer/2c2ca7e59f380aad3ba48ebc1960e97975e5702e/XLMailBoxContainer/Images.xcassets/AppIcon.appiconset/xl_appicon_80.png
--------------------------------------------------------------------------------
/XLMailBoxContainer/Images.xcassets/LaunchImage.launchimage/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "orientation" : "portrait",
5 | "idiom" : "iphone",
6 | "extent" : "full-screen",
7 | "minimum-system-version" : "7.0",
8 | "scale" : "2x"
9 | },
10 | {
11 | "extent" : "full-screen",
12 | "idiom" : "iphone",
13 | "subtype" : "retina4",
14 | "filename" : "xl_splash@2x.png",
15 | "minimum-system-version" : "7.0",
16 | "orientation" : "portrait",
17 | "scale" : "2x"
18 | }
19 | ],
20 | "info" : {
21 | "version" : 1,
22 | "author" : "xcode"
23 | }
24 | }
--------------------------------------------------------------------------------
/XLMailBoxContainer/Images.xcassets/LaunchImage.launchimage/xl_splash@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xmartlabs/XLMailBoxContainer/2c2ca7e59f380aad3ba48ebc1960e97975e5702e/XLMailBoxContainer/Images.xcassets/LaunchImage.launchimage/xl_splash@2x.png
--------------------------------------------------------------------------------
/XLMailBoxContainer/Images.xcassets/Simpsons/Apu_Nahasapeemapetilon.imageset/Apu_Nahasapeemapetilon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xmartlabs/XLMailBoxContainer/2c2ca7e59f380aad3ba48ebc1960e97975e5702e/XLMailBoxContainer/Images.xcassets/Simpsons/Apu_Nahasapeemapetilon.imageset/Apu_Nahasapeemapetilon.png
--------------------------------------------------------------------------------
/XLMailBoxContainer/Images.xcassets/Simpsons/Apu_Nahasapeemapetilon.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x",
6 | "filename" : "Apu_Nahasapeemapetilon.png"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | }
12 | ],
13 | "info" : {
14 | "version" : 1,
15 | "author" : "xcode"
16 | }
17 | }
--------------------------------------------------------------------------------
/XLMailBoxContainer/Images.xcassets/Simpsons/Bart_Simpsons.imageset/Bart_Simpsons.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xmartlabs/XLMailBoxContainer/2c2ca7e59f380aad3ba48ebc1960e97975e5702e/XLMailBoxContainer/Images.xcassets/Simpsons/Bart_Simpsons.imageset/Bart_Simpsons.png
--------------------------------------------------------------------------------
/XLMailBoxContainer/Images.xcassets/Simpsons/Bart_Simpsons.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x",
6 | "filename" : "Bart_Simpsons.png"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | }
12 | ],
13 | "info" : {
14 | "version" : 1,
15 | "author" : "xcode"
16 | }
17 | }
--------------------------------------------------------------------------------
/XLMailBoxContainer/Images.xcassets/Simpsons/Homer_Simpsons.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x",
6 | "filename" : "Homer_Simpsons.png"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | }
12 | ],
13 | "info" : {
14 | "version" : 1,
15 | "author" : "xcode"
16 | }
17 | }
--------------------------------------------------------------------------------
/XLMailBoxContainer/Images.xcassets/Simpsons/Homer_Simpsons.imageset/Homer_Simpsons.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xmartlabs/XLMailBoxContainer/2c2ca7e59f380aad3ba48ebc1960e97975e5702e/XLMailBoxContainer/Images.xcassets/Simpsons/Homer_Simpsons.imageset/Homer_Simpsons.png
--------------------------------------------------------------------------------
/XLMailBoxContainer/Images.xcassets/Simpsons/Lisa_Simpsons.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x",
6 | "filename" : "Lisa_Simpsons.png"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | }
12 | ],
13 | "info" : {
14 | "version" : 1,
15 | "author" : "xcode"
16 | }
17 | }
--------------------------------------------------------------------------------
/XLMailBoxContainer/Images.xcassets/Simpsons/Lisa_Simpsons.imageset/Lisa_Simpsons.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xmartlabs/XLMailBoxContainer/2c2ca7e59f380aad3ba48ebc1960e97975e5702e/XLMailBoxContainer/Images.xcassets/Simpsons/Lisa_Simpsons.imageset/Lisa_Simpsons.png
--------------------------------------------------------------------------------
/XLMailBoxContainer/Images.xcassets/Simpsons/Maggie_Simpsons.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x",
6 | "filename" : "Maggie_Simpsons.png"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | }
12 | ],
13 | "info" : {
14 | "version" : 1,
15 | "author" : "xcode"
16 | }
17 | }
--------------------------------------------------------------------------------
/XLMailBoxContainer/Images.xcassets/Simpsons/Maggie_Simpsons.imageset/Maggie_Simpsons.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xmartlabs/XLMailBoxContainer/2c2ca7e59f380aad3ba48ebc1960e97975e5702e/XLMailBoxContainer/Images.xcassets/Simpsons/Maggie_Simpsons.imageset/Maggie_Simpsons.png
--------------------------------------------------------------------------------
/XLMailBoxContainer/Images.xcassets/Simpsons/Marge_Simpsons.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x",
6 | "filename" : "Marge_Simpsons.png"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | }
12 | ],
13 | "info" : {
14 | "version" : 1,
15 | "author" : "xcode"
16 | }
17 | }
--------------------------------------------------------------------------------
/XLMailBoxContainer/Images.xcassets/Simpsons/Marge_Simpsons.imageset/Marge_Simpsons.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xmartlabs/XLMailBoxContainer/2c2ca7e59f380aad3ba48ebc1960e97975e5702e/XLMailBoxContainer/Images.xcassets/Simpsons/Marge_Simpsons.imageset/Marge_Simpsons.png
--------------------------------------------------------------------------------
/XLMailBoxContainer/Images.xcassets/Simpsons/Montgomery_Burns.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x",
6 | "filename" : "Montgomery_Burns.png"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | }
12 | ],
13 | "info" : {
14 | "version" : 1,
15 | "author" : "xcode"
16 | }
17 | }
--------------------------------------------------------------------------------
/XLMailBoxContainer/Images.xcassets/Simpsons/Montgomery_Burns.imageset/Montgomery_Burns.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xmartlabs/XLMailBoxContainer/2c2ca7e59f380aad3ba48ebc1960e97975e5702e/XLMailBoxContainer/Images.xcassets/Simpsons/Montgomery_Burns.imageset/Montgomery_Burns.png
--------------------------------------------------------------------------------
/XLMailBoxContainer/Images.xcassets/Simpsons/Ned_Flanders.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x",
6 | "filename" : "Ned_Flanders.png"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | }
12 | ],
13 | "info" : {
14 | "version" : 1,
15 | "author" : "xcode"
16 | }
17 | }
--------------------------------------------------------------------------------
/XLMailBoxContainer/Images.xcassets/Simpsons/Ned_Flanders.imageset/Ned_Flanders.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xmartlabs/XLMailBoxContainer/2c2ca7e59f380aad3ba48ebc1960e97975e5702e/XLMailBoxContainer/Images.xcassets/Simpsons/Ned_Flanders.imageset/Ned_Flanders.png
--------------------------------------------------------------------------------
/XLMailBoxContainer/Images.xcassets/Simpsons/Otto_Mann.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x",
6 | "filename" : "Otto_Mann.png"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | }
12 | ],
13 | "info" : {
14 | "version" : 1,
15 | "author" : "xcode"
16 | }
17 | }
--------------------------------------------------------------------------------
/XLMailBoxContainer/Images.xcassets/Simpsons/Otto_Mann.imageset/Otto_Mann.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xmartlabs/XLMailBoxContainer/2c2ca7e59f380aad3ba48ebc1960e97975e5702e/XLMailBoxContainer/Images.xcassets/Simpsons/Otto_Mann.imageset/Otto_Mann.png
--------------------------------------------------------------------------------
/XLMailBoxContainer/Images.xcassets/Simpsons/default-avatar.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "scale" : "2x",
10 | "filename" : "default-avatar@2x.png"
11 | }
12 | ],
13 | "info" : {
14 | "version" : 1,
15 | "author" : "xcode"
16 | }
17 | }
--------------------------------------------------------------------------------
/XLMailBoxContainer/Images.xcassets/Simpsons/default-avatar.imageset/default-avatar@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xmartlabs/XLMailBoxContainer/2c2ca7e59f380aad3ba48ebc1960e97975e5702e/XLMailBoxContainer/Images.xcassets/Simpsons/default-avatar.imageset/default-avatar@2x.png
--------------------------------------------------------------------------------
/XLMailBoxContainer/Images.xcassets/TabBar/Posts_Selected.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x",
6 | "filename" : "Posts_Selected.png"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | }
12 | ],
13 | "info" : {
14 | "version" : 1,
15 | "author" : "xcode"
16 | }
17 | }
--------------------------------------------------------------------------------
/XLMailBoxContainer/Images.xcassets/TabBar/Posts_Selected.imageset/Posts_Selected.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xmartlabs/XLMailBoxContainer/2c2ca7e59f380aad3ba48ebc1960e97975e5702e/XLMailBoxContainer/Images.xcassets/TabBar/Posts_Selected.imageset/Posts_Selected.png
--------------------------------------------------------------------------------
/XLMailBoxContainer/Images.xcassets/TabBar/Posts_Unselected.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x",
6 | "filename" : "Posts_Unselected.png"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | }
12 | ],
13 | "info" : {
14 | "version" : 1,
15 | "author" : "xcode"
16 | }
17 | }
--------------------------------------------------------------------------------
/XLMailBoxContainer/Images.xcassets/TabBar/Posts_Unselected.imageset/Posts_Unselected.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xmartlabs/XLMailBoxContainer/2c2ca7e59f380aad3ba48ebc1960e97975e5702e/XLMailBoxContainer/Images.xcassets/TabBar/Posts_Unselected.imageset/Posts_Unselected.png
--------------------------------------------------------------------------------
/XLMailBoxContainer/Images.xcassets/TabBar/Users_Selected.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x",
6 | "filename" : "Users_Selected.png"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | }
12 | ],
13 | "info" : {
14 | "version" : 1,
15 | "author" : "xcode"
16 | }
17 | }
--------------------------------------------------------------------------------
/XLMailBoxContainer/Images.xcassets/TabBar/Users_Selected.imageset/Users_Selected.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xmartlabs/XLMailBoxContainer/2c2ca7e59f380aad3ba48ebc1960e97975e5702e/XLMailBoxContainer/Images.xcassets/TabBar/Users_Selected.imageset/Users_Selected.png
--------------------------------------------------------------------------------
/XLMailBoxContainer/Images.xcassets/TabBar/Users_Unselected.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x",
6 | "filename" : "Users_Unselected.png"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | }
12 | ],
13 | "info" : {
14 | "version" : 1,
15 | "author" : "xcode"
16 | }
17 | }
--------------------------------------------------------------------------------
/XLMailBoxContainer/Images.xcassets/TabBar/Users_Unselected.imageset/Users_Unselected.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xmartlabs/XLMailBoxContainer/2c2ca7e59f380aad3ba48ebc1960e97975e5702e/XLMailBoxContainer/Images.xcassets/TabBar/Users_Unselected.imageset/Users_Unselected.png
--------------------------------------------------------------------------------
/XLMailBoxContainer/XL/Views/XLSwipeBarView.h:
--------------------------------------------------------------------------------
1 | //
2 | // XLSwipeBarView.h
3 | // XLMailBoxContainer ( https://github.com/xmartlabs/XLMailBoxContainer )
4 | //
5 | // Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
6 | //
7 | //
8 | // Permission is hereby granted, free of charge, to any person obtaining a copy
9 | // of this software and associated documentation files (the "Software"), to deal
10 | // in the Software without restriction, including without limitation the rights
11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | // copies of the Software, and to permit persons to whom the Software is
13 | // furnished to do so, subject to the following conditions:
14 | //
15 | // The above copyright notice and this permission notice shall be included in
16 | // all copies or substantial portions of the Software.
17 | //
18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 | // THE SOFTWARE.
25 |
26 | #import
27 |
28 | @interface XLSwipeBarView : UIView
29 |
30 | @property (readonly, nonatomic) UIView * selectedBar;
31 |
32 | -(id)initWithFrame:(CGRect)frame optionsAmount:(NSUInteger)optionsAmount selectedOptionIndex:(NSUInteger)selectedOptionIndex;
33 |
34 | -(void)moveToIndex:(NSUInteger)index animated:(BOOL)animated;
35 | -(void)setOptionsAmount:(NSUInteger)optionsAmount animated:(BOOL)animated;
36 |
37 | @end
38 |
--------------------------------------------------------------------------------
/XLMailBoxContainer/XL/Views/XLSwipeBarView.m:
--------------------------------------------------------------------------------
1 | //
2 | // XLSwipeBarView.m
3 | // XLMailBoxContainer ( https://github.com/xmartlabs/XLMailBoxContainer )
4 | //
5 | // Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
6 | //
7 | //
8 | // Permission is hereby granted, free of charge, to any person obtaining a copy
9 | // of this software and associated documentation files (the "Software"), to deal
10 | // in the Software without restriction, including without limitation the rights
11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | // copies of the Software, and to permit persons to whom the Software is
13 | // furnished to do so, subject to the following conditions:
14 | //
15 | // The above copyright notice and this permission notice shall be included in
16 | // all copies or substantial portions of the Software.
17 | //
18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 | // THE SOFTWARE.
25 |
26 | #import "XLSwipeBarView.h"
27 |
28 | @interface XLSwipeBarView()
29 |
30 | @property UIView * selectedBar;
31 | @property NSUInteger optionsAmount;
32 | @property NSUInteger selectedOptionIndex;
33 |
34 | @end
35 |
36 | @implementation XLSwipeBarView
37 |
38 | - (instancetype)initWithCoder:(NSCoder *)coder
39 | {
40 | self = [super initWithCoder:coder];
41 | if (self) {
42 | _optionsAmount = 1;
43 | _selectedOptionIndex = 0;
44 | [self addSubview:self.selectedBar];
45 | }
46 | return self;
47 | }
48 |
49 | - (id)initWithFrame:(CGRect)frame
50 | {
51 | self = [super initWithFrame:frame];
52 | if (self) {
53 | // Initialization code
54 | _optionsAmount = 1;
55 | _selectedOptionIndex = 0;
56 | }
57 | return self;
58 | }
59 |
60 | - (id)initWithFrame:(CGRect)frame optionsAmount:(NSUInteger)optionsAmount selectedOptionIndex:(NSUInteger)selectedOptionIndex
61 | {
62 | self = [self initWithFrame:frame];
63 | if (self){
64 | _optionsAmount = optionsAmount;
65 | _selectedOptionIndex = selectedOptionIndex;
66 | [self addSubview:self.selectedBar];
67 | }
68 | return self;
69 | }
70 |
71 | -(UIView *)selectedBar
72 | {
73 | if (_selectedBar) return _selectedBar;
74 | _selectedBar = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
75 | [self updateSelectedBarPositionWithAnimation:NO];
76 | return _selectedBar;
77 | }
78 |
79 |
80 | #pragma mark - Helpers
81 |
82 | -(void)updateSelectedBarPositionWithAnimation:(BOOL)animation
83 | {
84 | CGRect frame = self.selectedBar.frame;
85 | frame.size.width = self.frame.size.width / self.optionsAmount;
86 | frame.origin.x = frame.size.width * self.selectedOptionIndex;
87 | if (animation){
88 | [UIView animateWithDuration:0.3 animations:^{
89 | [self.selectedBar setFrame:frame];
90 | }];
91 | }
92 | else{
93 | self.selectedBar.frame = frame;
94 | }
95 | }
96 |
97 | -(void)moveToIndex:(NSUInteger)index animated:(BOOL)animated
98 | {
99 | self.selectedOptionIndex = index;
100 | [self updateSelectedBarPositionWithAnimation:animated];
101 | }
102 |
103 |
104 | -(void)setOptionsAmount:(NSUInteger)optionsAmount animated:(BOOL)animated
105 | {
106 | self.optionsAmount = optionsAmount;
107 | if (self.optionsAmount <= self.selectedOptionIndex){
108 | self.selectedOptionIndex = self.optionsAmount - 1;
109 | }
110 | [self updateSelectedBarPositionWithAnimation:animated];
111 | }
112 |
113 | -(void)layoutSubviews
114 | {
115 | [self updateSelectedBarPositionWithAnimation:NO];
116 | }
117 |
118 | @end
119 |
--------------------------------------------------------------------------------
/XLMailBoxContainer/XL/Views/XLSwipeButtonBarView.h:
--------------------------------------------------------------------------------
1 | //
2 | // XLSwipeButtonBarView.h
3 | // XLMailBoxContainer ( https://github.com/xmartlabs/XLMailBoxContainer )
4 | //
5 | // Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
6 | //
7 | //
8 | // Permission is hereby granted, free of charge, to any person obtaining a copy
9 | // of this software and associated documentation files (the "Software"), to deal
10 | // in the Software without restriction, including without limitation the rights
11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | // copies of the Software, and to permit persons to whom the Software is
13 | // furnished to do so, subject to the following conditions:
14 | //
15 | // The above copyright notice and this permission notice shall be included in
16 | // all copies or substantial portions of the Software.
17 | //
18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 | // THE SOFTWARE.
25 |
26 | #import
27 |
28 | #import "XLSwipeContainerController.h"
29 |
30 |
31 | @interface XLSwipeButtonBarView : UICollectionView
32 |
33 | @property (readonly, nonatomic) UIView * selectedBar;
34 | @property UIFont * labelFont;
35 | @property NSUInteger leftRightMargin;
36 |
37 | -(void)moveToIndex:(NSUInteger)index animated:(BOOL)animated swipeDirection:(XLSwipeDirection)swipeDirection;
38 |
39 |
40 |
41 |
42 | @end
43 |
--------------------------------------------------------------------------------
/XLMailBoxContainer/XL/Views/XLSwipeButtonBarView.m:
--------------------------------------------------------------------------------
1 | //
2 | // XLSwipeButtonBarView.m
3 | // XLMailBoxContainer ( https://github.com/xmartlabs/XLMailBoxContainer )
4 | //
5 | // Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
6 | //
7 | //
8 | // Permission is hereby granted, free of charge, to any person obtaining a copy
9 | // of this software and associated documentation files (the "Software"), to deal
10 | // in the Software without restriction, including without limitation the rights
11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | // copies of the Software, and to permit persons to whom the Software is
13 | // furnished to do so, subject to the following conditions:
14 | //
15 | // The above copyright notice and this permission notice shall be included in
16 | // all copies or substantial portions of the Software.
17 | //
18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 | // THE SOFTWARE.
25 |
26 |
27 | #import "XLSwipeButtonBarView.h"
28 |
29 | @interface XLSwipeButtonBarView ()
30 |
31 | @property UIView * selectedBar;
32 | @property NSUInteger selectedOptionIndex;
33 |
34 | @end
35 |
36 | @implementation XLSwipeButtonBarView
37 |
38 |
39 | - (instancetype)initWithCoder:(NSCoder *)coder
40 | {
41 | self = [super initWithCoder:coder];
42 | if (self) {
43 | [self initializeXLSwipeButtonBarView];
44 | }
45 | return self;
46 | }
47 |
48 |
49 | - (id)initWithFrame:(CGRect)frame
50 | {
51 | self = [super initWithFrame:frame];
52 | if (self) {
53 | [self initializeXLSwipeButtonBarView];
54 | }
55 | return self;
56 | }
57 |
58 | -(void)initializeXLSwipeButtonBarView
59 | {
60 | _selectedOptionIndex = 0;
61 | [self addSubview:self.selectedBar];
62 | }
63 |
64 |
65 | -(void)moveToIndex:(NSUInteger)index animated:(BOOL)animated swipeDirection:(XLSwipeDirection)swipeDirection
66 | {
67 | if (self.selectedOptionIndex != index){
68 | self.selectedOptionIndex = index;
69 | [self updateSelectedBarPositionWithAnimation:animated swipeDirection:swipeDirection];
70 | }
71 | }
72 |
73 |
74 | -(void)updateSelectedBarPositionWithAnimation:(BOOL)animation swipeDirection:(XLSwipeDirection)swipeDirection
75 | {
76 | CGRect frame = self.selectedBar.frame;
77 | UICollectionViewCell * cell = [self.dataSource collectionView:self cellForItemAtIndexPath:[NSIndexPath indexPathForItem:self.selectedOptionIndex inSection:0]];
78 | if (cell){
79 | if (swipeDirection != XLSwipeDirectionNone){
80 | if (swipeDirection == XLSwipeDirectionLeft)
81 | {
82 | float xValue = MIN(self.contentSize.width - self.frame.size.width, cell.frame.origin.x <= 35 ? 0 : cell.frame.origin.x - 35);
83 | [self setContentOffset:CGPointMake(xValue, 0) animated:animation];
84 | }
85 | else if (swipeDirection == XLSwipeDirectionRight){
86 | float xValue = MAX(0, cell.frame.origin.x + cell.frame.size.width - self.frame.size.width + 35);
87 | [self setContentOffset:CGPointMake(xValue, 0) animated:animation];
88 | }
89 |
90 | }
91 | }
92 | frame.size.width = cell.frame.size.width;
93 | frame.origin.x = cell.frame.origin.x;
94 | frame.origin.y = cell.frame.size.height - frame.size.height;
95 | if (animation){
96 | [UIView animateWithDuration:0.3 animations:^{
97 | [self.selectedBar setFrame:frame];
98 | }];
99 | }
100 | else{
101 | self.selectedBar.frame = frame;
102 | }
103 | }
104 |
105 |
106 | #pragma mark - Properties
107 |
108 | -(UIView *)selectedBar
109 | {
110 | if (_selectedBar) return _selectedBar;
111 | _selectedBar = [[UIView alloc] initWithFrame:CGRectMake(0, self.frame.size.height - 5, self.frame.size.width, 5)];
112 | _selectedBar.layer.zPosition = 9999;
113 | _selectedBar.backgroundColor = [UIColor blackColor];
114 | return _selectedBar;
115 | }
116 |
117 |
118 | @end
119 |
--------------------------------------------------------------------------------
/XLMailBoxContainer/XL/Views/XLSwipeButtonBarViewCell.h:
--------------------------------------------------------------------------------
1 | //
2 | // XLSwipeButtonBarViewCell.h
3 | // XLMailBoxContainer ( https://github.com/xmartlabs/XLMailBoxContainer )
4 | //
5 | // Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
6 | //
7 | //
8 | // Permission is hereby granted, free of charge, to any person obtaining a copy
9 | // of this software and associated documentation files (the "Software"), to deal
10 | // in the Software without restriction, including without limitation the rights
11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | // copies of the Software, and to permit persons to whom the Software is
13 | // furnished to do so, subject to the following conditions:
14 | //
15 | // The above copyright notice and this permission notice shall be included in
16 | // all copies or substantial portions of the Software.
17 | //
18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 | // THE SOFTWARE.
25 |
26 | #import
27 |
28 | @interface XLSwipeButtonBarViewCell : UICollectionViewCell
29 |
30 | @property (readonly, nonatomic) UIImageView * imageView;
31 | @property (readonly, nonatomic) UILabel * label;
32 |
33 | @end
34 |
--------------------------------------------------------------------------------
/XLMailBoxContainer/XL/Views/XLSwipeButtonBarViewCell.m:
--------------------------------------------------------------------------------
1 | //
2 | // XLSwipeButtonBarViewCell.m
3 | // XLMailBoxContainer ( https://github.com/xmartlabs/XLMailBoxContainer )
4 | //
5 | // Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
6 | //
7 | //
8 | // Permission is hereby granted, free of charge, to any person obtaining a copy
9 | // of this software and associated documentation files (the "Software"), to deal
10 | // in the Software without restriction, including without limitation the rights
11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | // copies of the Software, and to permit persons to whom the Software is
13 | // furnished to do so, subject to the following conditions:
14 | //
15 | // The above copyright notice and this permission notice shall be included in
16 | // all copies or substantial portions of the Software.
17 | //
18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 | // THE SOFTWARE.
25 |
26 | #import "XLSwipeButtonBarViewCell.h"
27 |
28 | @interface XLSwipeButtonBarViewCell()
29 |
30 | @property IBOutlet UIImageView * imageView;
31 | @property IBOutlet UILabel * label;
32 |
33 | @end
34 |
35 | @implementation XLSwipeButtonBarViewCell
36 |
37 |
38 |
39 |
40 | @end
41 |
--------------------------------------------------------------------------------
/XLMailBoxContainer/XL/XLBarSwipeContainerController.h:
--------------------------------------------------------------------------------
1 | //
2 | // XLBarSwipeContainerController.h
3 | // XLMailBoxContainer ( https://github.com/xmartlabs/XLMailBoxContainer )
4 | //
5 | // Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
6 | //
7 | //
8 | // Permission is hereby granted, free of charge, to any person obtaining a copy
9 | // of this software and associated documentation files (the "Software"), to deal
10 | // in the Software without restriction, including without limitation the rights
11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | // copies of the Software, and to permit persons to whom the Software is
13 | // furnished to do so, subject to the following conditions:
14 | //
15 | // The above copyright notice and this permission notice shall be included in
16 | // all copies or substantial portions of the Software.
17 | //
18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 | // THE SOFTWARE.
25 |
26 | #import "XLSwipeBarView.h"
27 | #import "XLSwipeContainerController.h"
28 |
29 | @interface XLBarSwipeContainerController : XLSwipeContainerController
30 |
31 | @property (nonatomic) IBOutlet XLSwipeBarView * swipeBar;
32 |
33 | @end
34 |
--------------------------------------------------------------------------------
/XLMailBoxContainer/XL/XLBarSwipeContainerController.m:
--------------------------------------------------------------------------------
1 | //
2 | // XLBarSwipeContainerController.m
3 | // XLMailBoxContainer ( https://github.com/xmartlabs/XLMailBoxContainer )
4 | //
5 | // Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
6 | //
7 | //
8 | // Permission is hereby granted, free of charge, to any person obtaining a copy
9 | // of this software and associated documentation files (the "Software"), to deal
10 | // in the Software without restriction, including without limitation the rights
11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | // copies of the Software, and to permit persons to whom the Software is
13 | // furnished to do so, subject to the following conditions:
14 | //
15 | // The above copyright notice and this permission notice shall be included in
16 | // all copies or substantial portions of the Software.
17 | //
18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 | // THE SOFTWARE.
25 |
26 | #import "XLBarSwipeContainerController.h"
27 |
28 | @interface XLBarSwipeContainerController ()
29 |
30 | @end
31 |
32 | @implementation XLBarSwipeContainerController
33 |
34 | - (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
35 | {
36 | self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
37 | if (self) {
38 | }
39 | return self;
40 | }
41 |
42 | - (instancetype)initWithCoder:(NSCoder *)coder
43 | {
44 | self = [super initWithCoder:coder];
45 | if (self) {
46 | }
47 | return self;
48 | }
49 |
50 |
51 | -(void)viewWillAppear:(BOOL)animated
52 | {
53 | [super viewWillAppear:animated];
54 | if (!self.swipeBar.superview){
55 | [self.view addSubview:self.swipeBar];
56 | }
57 | else{
58 | [self.swipeBar setOptionsAmount:[self.dataSource swipeContainerControllerViewControllers:self].count animated:NO];
59 | [self.swipeBar moveToIndex:self.currentIndex animated:NO];
60 | }
61 | }
62 |
63 | -(XLSwipeBarView *)swipeBar
64 | {
65 | if (_swipeBar) return _swipeBar;
66 | _swipeBar = [[XLSwipeBarView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 5.0f) optionsAmount:[self.dataSource swipeContainerControllerViewControllers:self].count selectedOptionIndex:self.currentIndex];
67 | _swipeBar.backgroundColor = [UIColor orangeColor];
68 | _swipeBar.selectedBar.backgroundColor = [UIColor blackColor];
69 | _swipeBar.autoresizingMask = UIViewAutoresizingFlexibleWidth;
70 | return _swipeBar;
71 | }
72 |
73 | #pragma mark - XLSwipeContainerControllerDelegate
74 |
75 | -(void)swipeContainerController:(XLSwipeContainerController *)swipeContainerController updateIndicatorToViewController:(UIViewController *)viewController fromViewController:(UIViewController *)fromViewController
76 | {
77 | [self.swipeBar moveToIndex:[self.swipeViewControllers indexOfObject:viewController] animated:YES];
78 | }
79 |
80 |
81 |
82 | @end
83 |
--------------------------------------------------------------------------------
/XLMailBoxContainer/XL/XLButtonBarSwipeContainerController.h:
--------------------------------------------------------------------------------
1 | //
2 | // XLButtonBarSwipeContainerController.h
3 | // XLMailBoxContainer ( https://github.com/xmartlabs/XLMailBoxContainer )
4 | //
5 | // Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
6 | //
7 | //
8 | // Permission is hereby granted, free of charge, to any person obtaining a copy
9 | // of this software and associated documentation files (the "Software"), to deal
10 | // in the Software without restriction, including without limitation the rights
11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | // copies of the Software, and to permit persons to whom the Software is
13 | // furnished to do so, subject to the following conditions:
14 | //
15 | // The above copyright notice and this permission notice shall be included in
16 | // all copies or substantial portions of the Software.
17 | //
18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 | // THE SOFTWARE.
25 |
26 | #import "XLSwipeButtonBarView.h"
27 | #import "XLSwipeContainerController.h"
28 |
29 | @interface XLButtonBarSwipeContainerController : XLSwipeContainerController
30 |
31 | @property (readonly, nonatomic) XLSwipeButtonBarView * swipeBar;
32 |
33 | @end
34 |
--------------------------------------------------------------------------------
/XLMailBoxContainer/XL/XLButtonBarSwipeContainerController.m:
--------------------------------------------------------------------------------
1 | //
2 | // XLButtonBarSwipeContainerController.m
3 | // XLMailBoxContainer ( https://github.com/xmartlabs/XLMailBoxContainer )
4 | //
5 | // Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
6 | //
7 | //
8 | // Permission is hereby granted, free of charge, to any person obtaining a copy
9 | // of this software and associated documentation files (the "Software"), to deal
10 | // in the Software without restriction, including without limitation the rights
11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | // copies of the Software, and to permit persons to whom the Software is
13 | // furnished to do so, subject to the following conditions:
14 | //
15 | // The above copyright notice and this permission notice shall be included in
16 | // all copies or substantial portions of the Software.
17 | //
18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 | // THE SOFTWARE.
25 |
26 | #import "XLSwipeButtonBarViewCell.h"
27 | #import "XLButtonBarSwipeContainerController.h"
28 |
29 | @interface XLButtonBarSwipeContainerController ()
30 |
31 | @property (nonatomic) IBOutlet XLSwipeButtonBarView * swipeBar;
32 | @property (nonatomic) BOOL shouldUpdateSwipeBar;
33 |
34 | @end
35 |
36 | @implementation XLButtonBarSwipeContainerController
37 | {
38 | XLSwipeButtonBarViewCell * _sizeCell;
39 | }
40 |
41 | - (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
42 | {
43 | self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
44 | if (self) {
45 | self.shouldUpdateSwipeBar = YES;
46 | }
47 | return self;
48 | }
49 |
50 | - (instancetype)initWithCoder:(NSCoder *)coder
51 | {
52 | self = [super initWithCoder:coder];
53 | if (self) {
54 | self.shouldUpdateSwipeBar = YES;
55 | }
56 | return self;
57 | }
58 |
59 | - (void)viewDidLoad
60 | {
61 | [super viewDidLoad];
62 | // Do any additional setup after loading the view.
63 | if (!self.swipeBar.superview){
64 | [self.view addSubview:self.swipeBar];
65 | }
66 | if (!self.swipeBar.delegate){
67 | self.swipeBar.delegate = self;
68 | }
69 | if (!self.swipeBar.dataSource){
70 | self.swipeBar.dataSource = self;
71 | }
72 | self.swipeBar.labelFont = [UIFont fontWithName:@"Helvetica-Bold" size:18.0f];
73 | self.swipeBar.leftRightMargin = 8;
74 | UICollectionViewFlowLayout * flowLayout = (id)self.swipeBar.collectionViewLayout;
75 | [flowLayout setScrollDirection:UICollectionViewScrollDirectionHorizontal];
76 | [self.swipeBar setShowsHorizontalScrollIndicator:NO];
77 | }
78 |
79 | -(void)viewWillAppear:(BOOL)animated
80 | {
81 | [super viewWillAppear:animated];
82 | UICollectionViewLayoutAttributes *attributes = [self.swipeBar layoutAttributesForItemAtIndexPath:[NSIndexPath indexPathForItem:self.currentIndex inSection:0]];
83 | CGRect cellRect = attributes.frame;
84 | [self.swipeBar.selectedBar setFrame:CGRectMake(cellRect.origin.x, self.swipeBar.frame.size.height - 5, cellRect.size.width, 5)];
85 | }
86 |
87 |
88 | -(XLSwipeButtonBarView *)swipeBar
89 | {
90 | if (_swipeBar) return _swipeBar;
91 | UICollectionViewFlowLayout * flowLayout = [[UICollectionViewFlowLayout alloc] init];
92 | [flowLayout setScrollDirection:UICollectionViewScrollDirectionHorizontal];
93 | [flowLayout setSectionInset:UIEdgeInsetsMake(0, 35, 0, 35)];
94 | _swipeBar = [[XLSwipeButtonBarView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 50.0f) collectionViewLayout:flowLayout];
95 | _swipeBar.backgroundColor = [UIColor orangeColor];
96 | _swipeBar.selectedBar.backgroundColor = [UIColor blackColor];
97 | _swipeBar.autoresizingMask = UIViewAutoresizingFlexibleWidth;
98 | return _swipeBar;
99 | }
100 |
101 | #pragma mark - XLSwipeContainerControllerDelegate
102 |
103 | -(void)swipeContainerController:(XLSwipeContainerController *)swipeContainerController updateIndicatorToViewController:(UIViewController *)viewController fromViewController:(UIViewController *)fromViewController
104 | {
105 | if (self.shouldUpdateSwipeBar){
106 | NSUInteger newIndex = [self.swipeViewControllers indexOfObject:viewController];
107 | XLSwipeDirection direction = XLSwipeDirectionLeft;
108 | if (newIndex < [self.swipeViewControllers indexOfObject:fromViewController]){
109 | direction = XLSwipeDirectionRight;
110 | }
111 | [self.swipeBar moveToIndex:newIndex animated:YES swipeDirection:direction];
112 | }
113 | }
114 |
115 |
116 |
117 | #pragma merk - UICollectionViewDelegateFlowLayout
118 |
119 | - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath
120 | {
121 | UILabel * label = [[UILabel alloc] init];
122 | [label setTranslatesAutoresizingMaskIntoConstraints:NO];
123 | label.font = self.swipeBar.labelFont;
124 | UIViewController * childController = [self.swipeViewControllers objectAtIndex:indexPath.item];
125 | [label setText:[childController nameForSwipeContainer:self]];
126 | CGSize labelSize = [label intrinsicContentSize];
127 |
128 | return CGSizeMake(labelSize.width + (self.swipeBar.leftRightMargin * 2), collectionView.frame.size.height);
129 | }
130 |
131 | #pragma mark - UICollectionViewDelegate
132 |
133 |
134 | - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
135 | {
136 | [self.swipeBar moveToIndex:indexPath.item animated:YES swipeDirection:XLSwipeDirectionNone];
137 | self.shouldUpdateSwipeBar = NO;
138 | [self moveToViewControllerAtIndex:indexPath.item];
139 | }
140 |
141 | #pragma merk - UICollectionViewDataSource
142 |
143 | -(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
144 | {
145 | return self.swipeViewControllers.count;
146 | }
147 |
148 | // The cell that is returned must be retrieved from a call to -dequeueReusableCellWithReuseIdentifier:forIndexPath:
149 | - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
150 | {
151 | UICollectionViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"Cell" forIndexPath:indexPath];
152 | if (!cell){
153 | cell = [[XLSwipeButtonBarViewCell alloc] initWithFrame:CGRectMake(0, 0, 50, self.swipeBar.frame.size.height)];
154 | }
155 | NSAssert([cell isKindOfClass:[XLSwipeButtonBarViewCell class]], @"UICollectionViewCell should be or extend XLSwipeButtonBarViewCell");
156 | XLSwipeButtonBarViewCell * swipeCell = (XLSwipeButtonBarViewCell *)cell;
157 | UIViewController * childController = [self.swipeViewControllers objectAtIndex:indexPath.item];
158 |
159 | [swipeCell.label setText:[childController nameForSwipeContainer:self]];
160 |
161 | return swipeCell;
162 | }
163 |
164 |
165 | #pragma mark - UIScrollViewDelegate
166 |
167 | -(void)scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView
168 | {
169 | [super scrollViewDidEndScrollingAnimation:scrollView];
170 | if (scrollView == self.containerView){
171 | self.shouldUpdateSwipeBar = YES;
172 | }
173 | }
174 |
175 |
176 | @end
177 |
--------------------------------------------------------------------------------
/XLMailBoxContainer/XL/XLSegmentedSwipeContainerController.h:
--------------------------------------------------------------------------------
1 | //
2 | // XLSegmentedSwipeContainerController.h
3 | // XLMailBoxContainer ( https://github.com/xmartlabs/XLMailBoxContainer )
4 | //
5 | // Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
6 | //
7 | //
8 | // Permission is hereby granted, free of charge, to any person obtaining a copy
9 | // of this software and associated documentation files (the "Software"), to deal
10 | // in the Software without restriction, including without limitation the rights
11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | // copies of the Software, and to permit persons to whom the Software is
13 | // furnished to do so, subject to the following conditions:
14 | //
15 | // The above copyright notice and this permission notice shall be included in
16 | // all copies or substantial portions of the Software.
17 | //
18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 | // THE SOFTWARE.
25 |
26 | #import "XLSwipeContainerController.h"
27 |
28 | @interface XLSegmentedSwipeContainerController : XLSwipeContainerController
29 |
30 | @property (nonatomic, readonly) UISegmentedControl * segmentedControl;
31 |
32 | @end
33 |
--------------------------------------------------------------------------------
/XLMailBoxContainer/XL/XLSegmentedSwipeContainerController.m:
--------------------------------------------------------------------------------
1 | //
2 | // XLSegmentedSwipeContainerController.m
3 | // XLMailBoxContainer ( https://github.com/xmartlabs/XLMailBoxContainer )
4 | //
5 | // Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
6 | //
7 | //
8 | // Permission is hereby granted, free of charge, to any person obtaining a copy
9 | // of this software and associated documentation files (the "Software"), to deal
10 | // in the Software without restriction, including without limitation the rights
11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | // copies of the Software, and to permit persons to whom the Software is
13 | // furnished to do so, subject to the following conditions:
14 | //
15 | // The above copyright notice and this permission notice shall be included in
16 | // all copies or substantial portions of the Software.
17 | //
18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 | // THE SOFTWARE.
25 |
26 | #import "XLSwipeContainerController.h"
27 | #import "XLSegmentedSwipeContainerController.h"
28 |
29 | @interface XLSegmentedSwipeContainerController ()
30 |
31 | @property (nonatomic) IBOutlet UISegmentedControl * segmentedControl;
32 | @property (nonatomic) BOOL shouldUpdateSegmentedControl;
33 |
34 | @end
35 |
36 | @implementation XLSegmentedSwipeContainerController
37 |
38 | -(id)initWithCoder:(NSCoder *)aDecoder
39 | {
40 | self = [super initWithCoder:aDecoder];
41 | if (self){
42 | self.shouldUpdateSegmentedControl = YES;
43 | }
44 | return self;
45 | }
46 |
47 | -(instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
48 | {
49 | self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
50 | if (self){
51 | self.shouldUpdateSegmentedControl = YES;
52 | }
53 | return self;
54 | }
55 |
56 | -(void)viewDidLoad
57 | {
58 | [super viewDidLoad];
59 | // initialize segmented control
60 | if (!self.segmentedControl.superview) {
61 | [self.navigationItem setTitleView:self.segmentedControl];
62 | }
63 | [self.segmentedControl removeAllSegments];
64 | [self.segmentedControl addTarget:self
65 | action:@selector(changeSwipeViewController:)
66 | forControlEvents:UIControlEventValueChanged];
67 | [self.swipeViewControllers enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
68 | NSAssert([obj conformsToProtocol:@protocol(XLSwipeContainerChildItem)], @"child view controller must conform to XLSwipeContainerChildItem");
69 | UIViewController * childViewController = (UIViewController *)obj;
70 | if ([childViewController respondsToSelector:@selector(imageForSwipeContainer:)]){
71 |
72 | [self.segmentedControl insertSegmentWithImage:[childViewController imageForSwipeContainer:self] atIndex:idx animated:NO];
73 | }
74 | else{
75 | [self.segmentedControl insertSegmentWithTitle:[childViewController nameForSwipeContainer:self] atIndex:idx animated:NO];
76 | }
77 |
78 | }];
79 | [self.segmentedControl setSelectedSegmentIndex:self.currentIndex];
80 |
81 | }
82 |
83 |
84 |
85 | -(UISegmentedControl *)segmentedControl
86 | {
87 | if (_segmentedControl) return _segmentedControl;
88 | _segmentedControl = [[UISegmentedControl alloc] init];
89 | return _segmentedControl;
90 | }
91 |
92 |
93 | -(void)changeSwipeViewController:(UISegmentedControl *)sender
94 | {
95 | NSInteger index = [sender selectedSegmentIndex];
96 | [self swipeContainerController:self updateIndicatorToViewController:[[self.dataSource swipeContainerControllerViewControllers:self] objectAtIndex:index] fromViewController:nil];
97 | self.shouldUpdateSegmentedControl = NO;
98 | [self moveToViewControllerAtIndex:index];
99 | }
100 |
101 | #pragma mark - XLSwipeContainerControllerDelegate
102 |
103 | -(void)swipeContainerController:(XLSwipeContainerController *)swipeContainerController updateIndicatorToViewController:(UIViewController *)viewController fromViewController:(UIViewController *)fromViewController
104 | {
105 | if (self.shouldUpdateSegmentedControl){
106 | UIViewController * childViewController = (UIViewController *)viewController;
107 | if ([childViewController respondsToSelector:@selector(colorForSwipeContainer:)]){
108 | [self.segmentedControl setTintColor:[childViewController colorForSwipeContainer:self]];
109 | }
110 | [self.segmentedControl setSelectedSegmentIndex:[self.swipeViewControllers indexOfObject:childViewController]];
111 | }
112 | }
113 |
114 |
115 | #pragma mark - UIScrollViewDelegate
116 |
117 | -(void)scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView
118 | {
119 | [super scrollViewDidEndScrollingAnimation:scrollView];
120 | self.shouldUpdateSegmentedControl = YES;
121 | }
122 |
123 | @end
124 |
--------------------------------------------------------------------------------
/XLMailBoxContainer/XL/XLSwipeContainerController.h:
--------------------------------------------------------------------------------
1 | //
2 | // XLSwipeContainerController.h
3 | // XLMailBoxContainer ( https://github.com/xmartlabs/XLMailBoxContainer )
4 | //
5 | // Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
6 | //
7 | //
8 | // Permission is hereby granted, free of charge, to any person obtaining a copy
9 | // of this software and associated documentation files (the "Software"), to deal
10 | // in the Software without restriction, including without limitation the rights
11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | // copies of the Software, and to permit persons to whom the Software is
13 | // furnished to do so, subject to the following conditions:
14 | //
15 | // The above copyright notice and this permission notice shall be included in
16 | // all copies or substantial portions of the Software.
17 | //
18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 | // THE SOFTWARE.
25 |
26 | #import
27 | #import
28 |
29 | @class XLSwipeContainerController;
30 |
31 | /**
32 | The `XLSwipeContainerItemDelegate` protocol is adopted by child controllers of XLSwipeContainerController. Each child view controller has to define a color and either a image or string in order to create the related UISegmentedControl option and update the color accordingly when the selected child view controller change.
33 | */
34 | @protocol XLSwipeContainerChildItem
35 |
36 | @required
37 |
38 | - (NSString *)nameForSwipeContainer:(XLSwipeContainerController *)swipeContainer;
39 |
40 | @optional
41 |
42 | - (UIImage *)imageForSwipeContainer:(XLSwipeContainerController *)swipeContainer;
43 | - (UIColor *)colorForSwipeContainer:(XLSwipeContainerController *)swipeContainer;
44 |
45 | @end
46 |
47 |
48 |
49 | typedef NS_ENUM(NSUInteger, XLSwipeDirection) {
50 | XLSwipeDirectionLeft,
51 | XLSwipeDirectionRight,
52 | XLSwipeDirectionNone
53 | };
54 |
55 |
56 |
57 | @protocol XLSwipeContainerControllerDelegate
58 |
59 | @optional
60 |
61 | -(void)swipeContainerController:(XLSwipeContainerController *)swipeContainerController updateIndicatorToViewController:(UIViewController *)toViewController fromViewController:(UIViewController *)fromViewController;
62 |
63 | @end
64 |
65 |
66 | @protocol XLSwipeContainerControllerDataSource
67 |
68 | @required
69 |
70 | -(NSArray *)swipeContainerControllerViewControllers:(XLSwipeContainerController *)swipeContainerController;
71 |
72 | @end
73 |
74 |
75 |
76 | @interface XLSwipeContainerController : UIViewController
77 |
78 | /**
79 | Initializes a `XLSwipeContainerController` object with child controllers contained in viewControllers parameter.
80 | @param viewControllers ChildViewControllers to be added to XLSwipeContainerController.
81 | @return The newly-initialized XLSwipeContainerController custom container controller.
82 | */
83 | -(id)initWithViewControllers:(NSArray *)viewControllers;
84 |
85 | /**
86 | Initializes a `XLSwipeContainerController` object with child controllers contained in viewControllers parameter.
87 | This is the designated initializer.
88 | @param viewControllers hildViewControllers to be added to XLSwipeContainerController.
89 | @param currentIndex Index of childViewController selected by default.
90 | @return The newly-initialized XLSwipeContainerController custom container controller.
91 | */
92 | -(id)initWithViewControllers:(NSArray *)viewControllers currentIndex:(NSUInteger)currentIndex;
93 |
94 | -(id)initWithViewCurrentIndex:(NSUInteger)index viewControllers:(UIViewController *)firstViewController, ... NS_REQUIRES_NIL_TERMINATION;
95 |
96 | /**
97 | @return array containing all childViewControllers.
98 | */
99 | @property (readonly) NSArray * swipeViewControllers;
100 | @property (nonatomic, retain) IBOutlet UIScrollView * containerView;
101 | @property (nonatomic, assign) IBOutlet id delegate;
102 | @property (nonatomic, assign) IBOutlet id dataSource;
103 |
104 | @property (readonly) NSUInteger currentIndex;
105 | @property BOOL skipIntermediateViewControllers;
106 |
107 | -(void)moveToViewControllerAtIndex:(NSUInteger)index;
108 | -(void)moveToViewController:(UIViewController *)viewController;
109 |
110 | @end
111 |
--------------------------------------------------------------------------------
/XLMailBoxContainer/XL/XLSwipeContainerController.m:
--------------------------------------------------------------------------------
1 | //
2 | // XLSwipeContainerController.m
3 | // XLMailBoxContainer ( https://github.com/xmartlabs/XLMailBoxContainer )
4 | //
5 | // Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
6 | //
7 | //
8 | // Permission is hereby granted, free of charge, to any person obtaining a copy
9 | // of this software and associated documentation files (the "Software"), to deal
10 | // in the Software without restriction, including without limitation the rights
11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | // copies of the Software, and to permit persons to whom the Software is
13 | // furnished to do so, subject to the following conditions:
14 | //
15 | // The above copyright notice and this permission notice shall be included in
16 | // all copies or substantial portions of the Software.
17 | //
18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 | // THE SOFTWARE.
25 |
26 | #import "XLSwipeContainerController.h"
27 |
28 | @interface XLSwipeContainerController ()
29 |
30 | @property (nonatomic) NSUInteger currentIndex;
31 |
32 | @end
33 |
34 | @implementation XLSwipeContainerController
35 | {
36 | NSUInteger _lastPageNumber;
37 | CGFloat _lastContentOffset;
38 | NSUInteger _pageBeforeRotate;
39 | NSArray * _originalSwipeViewControllers;
40 | }
41 |
42 | @synthesize currentIndex = _currentIndex;
43 |
44 | #pragma maek - initializers
45 |
46 | -(id)initWithViewControllers:(NSArray *)viewControllers{
47 | return [self initWithViewControllers:viewControllers currentIndex:0];
48 | }
49 |
50 | -(id)initWithViewControllers:(NSArray *)viewControllers currentIndex:(NSUInteger)currentIndex
51 | {
52 | self = [self initWithNibName:nil bundle:nil];
53 | if (self){
54 | _currentIndex = currentIndex;
55 | _swipeViewControllers = viewControllers;
56 | }
57 | return self;
58 | }
59 |
60 | -(id)initWithViewCurrentIndex:(NSUInteger)index viewControllers:(UIViewController *)firstViewController, ...
61 | {
62 | id eachObject;
63 | va_list argumentList;
64 | NSMutableArray * mutableArray = [[NSMutableArray alloc] init];
65 | if (firstViewController){ // The first argument isn't part of the varargs list,
66 | // so we'll handle it separately.
67 | [mutableArray addObject:firstViewController];
68 | va_start(argumentList, firstViewController); // Start scanning for arguments after firstViewController.
69 | while ((eachObject = va_arg(argumentList, id))) // As many times as we can get an argument of type "id"
70 | [mutableArray addObject:eachObject]; // that isn't nil, add it to self's contents.
71 | va_end(argumentList);
72 | }
73 | return [self initWithViewControllers:[mutableArray copy] currentIndex:index];
74 | }
75 |
76 | -(id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
77 | {
78 | self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
79 | if (self){
80 | [self swipeInit];
81 | }
82 | return self;
83 | }
84 |
85 |
86 | -(id)initWithCoder:(NSCoder *)aDecoder
87 | {
88 | self = [super initWithCoder:aDecoder];
89 | if (self)
90 | {
91 | [self swipeInit];
92 | }
93 | return self;
94 | }
95 |
96 |
97 | -(void)swipeInit
98 | {
99 | _currentIndex = 0;
100 | _delegate = self;
101 | _dataSource = self;
102 | _lastContentOffset = 0.0f;
103 | _skipIntermediateViewControllers = YES;
104 | }
105 |
106 | - (void)viewDidLoad
107 | {
108 | [super viewDidLoad];
109 | if (!self.containerView){
110 | self.containerView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth(self.view.bounds), CGRectGetHeight(self.view.bounds))];
111 | self.containerView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
112 |
113 | [self.view addSubview:self.containerView];
114 | }
115 | self.containerView.bounces = YES;
116 | [self.containerView setAlwaysBounceHorizontal:YES];
117 | [self.containerView setAlwaysBounceVertical:NO];
118 | self.containerView.scrollsToTop = NO;
119 | self.containerView.delegate = self;
120 | self.containerView.showsVerticalScrollIndicator = NO;
121 | self.containerView.showsHorizontalScrollIndicator = NO;
122 | self.containerView.pagingEnabled = YES;
123 |
124 | if (self.dataSource){
125 | _swipeViewControllers = [self.dataSource swipeContainerControllerViewControllers:self];
126 | }
127 | self.containerView.contentSize = CGSizeMake(CGRectGetWidth(self.containerView.bounds) * self.swipeViewControllers.count, 1.0);;
128 |
129 | // add child viewController
130 | CGFloat childPosition = [self offsetForChildIndex:self.currentIndex];
131 | UIViewController * viewController = [self.swipeViewControllers objectAtIndex:self.currentIndex];
132 | if (viewController){
133 | [self addChildViewController:viewController];
134 | [viewController.view setFrame:CGRectMake(childPosition, 0, CGRectGetWidth(self.view.bounds), CGRectGetHeight(self.containerView.bounds))];
135 | viewController.view.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
136 | [self.containerView addSubview:viewController.view];
137 | [viewController didMoveToParentViewController:self];
138 | }
139 | }
140 |
141 | -(void)viewWillAppear:(BOOL)animated
142 | {
143 | [super viewWillAppear:animated];
144 | [self.containerView setContentOffset:CGPointMake([self pageOffsetForChildIndex:self.currentIndex], 0) animated:NO];
145 | }
146 |
147 |
148 | #pragma mark - move to another view controller
149 |
150 | -(void)moveToViewControllerAtIndex:(NSUInteger)index
151 | {
152 | [self moveToViewControllerAtIndex:index animated:YES];
153 | }
154 |
155 | -(void)moveToViewControllerAtIndex:(NSInteger)index withDirection:(XLSwipeDirection)direction animated:(BOOL)animated
156 | {
157 | if (self.skipIntermediateViewControllers && fabs(self.currentIndex - index) > 1){
158 | NSArray * originalSwipeViewControllers = self.swipeViewControllers;
159 | NSMutableArray * tempChildViewControllers = [NSMutableArray arrayWithArray:originalSwipeViewControllers];
160 | UIViewController * currentChildVC = [originalSwipeViewControllers objectAtIndex:self.currentIndex];
161 | NSUInteger fromIndex = (direction == XLSwipeDirectionLeft) ? index -1 : index + 1;
162 | [tempChildViewControllers setObject:[originalSwipeViewControllers objectAtIndex:fromIndex] atIndexedSubscript:self.currentIndex];
163 | [tempChildViewControllers setObject:currentChildVC atIndexedSubscript:fromIndex];
164 | _swipeViewControllers = tempChildViewControllers;
165 | [self.containerView setContentOffset:CGPointMake([self pageOffsetForChildIndex:fromIndex], 0) animated:NO];
166 | if (self.navigationController){
167 | self.navigationController.view.userInteractionEnabled = NO;
168 | }
169 | else{
170 | self.view.userInteractionEnabled = NO;
171 | }
172 | _originalSwipeViewControllers = originalSwipeViewControllers;
173 | [self.containerView setContentOffset:CGPointMake([self pageOffsetForChildIndex:index], 0) animated:YES];
174 | }
175 | else{
176 | [self.containerView setContentOffset:CGPointMake([self pageOffsetForChildIndex:index], 0) animated:animated];
177 | }
178 | }
179 |
180 | -(void)moveToViewControllerAtIndex:(NSUInteger)index animated:(bool)animated
181 | {
182 | if (![self isViewLoaded]){
183 | self.currentIndex = index;
184 | }
185 | else{
186 | if (self.currentIndex < index){
187 | [self moveToViewControllerAtIndex:index withDirection:XLSwipeDirectionLeft animated:YES];
188 | }
189 | else if (self.currentIndex > index){
190 | [self moveToViewControllerAtIndex:index withDirection:XLSwipeDirectionRight animated:YES];
191 | }
192 | }
193 | }
194 |
195 |
196 | -(void)moveToViewController:(UIViewController *)viewController
197 | {
198 | [self moveToViewControllerAtIndex:[self.swipeViewControllers indexOfObject:viewController]];
199 | }
200 |
201 |
202 | #pragma mark - XLSwipeContainerControllerDelegate
203 |
204 | -(void)swipeContainerController:(XLSwipeContainerController *)swipeContainerController updateIndicatorToViewController:(UIViewController *)toViewController fromViewController:(UIViewController *)fromViewController
205 | {
206 | }
207 |
208 |
209 | #pragma mark - XLSwipeContainerControllerDataSource
210 |
211 | -(NSArray *)swipeContainerControllerViewControllers:(XLSwipeContainerController *)swipeContainerController
212 | {
213 | return self.swipeViewControllers;
214 | }
215 |
216 |
217 | #pragma mark - Helpers
218 |
219 | -(BOOL)canMoveToIndex:(NSUInteger)index
220 | {
221 | return (self.currentIndex != index && self.swipeViewControllers.count > index);
222 | }
223 |
224 | -(CGFloat)pageOffsetForChildIndex:(NSUInteger)index
225 | {
226 | return (index * CGRectGetWidth(self.containerView.bounds));
227 | }
228 |
229 | -(CGFloat)offsetForChildIndex:(NSUInteger)index
230 | {
231 | return (index * CGRectGetWidth(self.containerView.bounds) + ((CGRectGetWidth(self.containerView.bounds) - CGRectGetWidth(self.view.bounds)) * 0.5));
232 | }
233 |
234 | -(CGFloat)offsetForChildViewController:(UIViewController *)viewController
235 | {
236 | NSInteger index = [self.swipeViewControllers indexOfObject:viewController];
237 | if (index == NSNotFound){
238 | @throw [NSException exceptionWithName:NSRangeException reason:nil userInfo:nil];
239 | }
240 | return [self offsetForChildIndex:index];
241 | }
242 |
243 | -(NSUInteger)pageForContentOffset:(CGFloat)contentOffset
244 | {
245 | return (contentOffset + (0.5f * [self pageWidth])) / [self pageWidth];
246 | }
247 |
248 | -(CGFloat)pageWidth
249 | {
250 | return CGRectGetWidth(self.containerView.bounds);
251 | }
252 |
253 | -(CGFloat)scrollPercentage
254 | {
255 | return fmodf(self.containerView.contentOffset.x, [self pageWidth]) / [self pageWidth];
256 | }
257 |
258 | -(void)updateContent
259 | {
260 | NSArray * childViewControllers = self.swipeViewControllers;
261 | self.containerView.contentSize = CGSizeMake(CGRectGetWidth(self.containerView.bounds) * childViewControllers.count, self.containerView.contentSize.height);
262 | NSUInteger currentPage = [self pageForContentOffset:self.containerView.contentOffset.x];
263 | if (currentPage != self.currentIndex){
264 | self.currentIndex = currentPage;
265 | }
266 |
267 | [childViewControllers enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
268 | UIViewController * childController = (UIViewController *)obj;
269 | CGFloat pageOffsetForChild = [self pageOffsetForChildIndex:idx];
270 | if (fabs(self.containerView.contentOffset.x - pageOffsetForChild) < CGRectGetWidth(self.containerView.bounds)){
271 | if (![childController parentViewController]){
272 | [self addChildViewController:childController];
273 | [childController didMoveToParentViewController:self];
274 | CGFloat childPosition = [self offsetForChildIndex:idx];
275 | [childController.view setFrame:CGRectMake(childPosition, 0, CGRectGetWidth(self.view.bounds), CGRectGetHeight(self.containerView.bounds))];
276 | childController.view.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
277 | [self.containerView addSubview:childController.view];
278 | }
279 | else{
280 | CGFloat childPosition = [self offsetForChildIndex:idx];
281 | [childController.view setFrame:CGRectMake(childPosition, 0, CGRectGetWidth(self.view.bounds), CGRectGetHeight(self.containerView.bounds))];
282 | childController.view.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
283 | }
284 | }
285 | else{
286 | if ([childController parentViewController]){
287 | [childController.view removeFromSuperview];
288 | [childController willMoveToParentViewController:nil];
289 | [childController removeFromParentViewController];
290 | }
291 | }
292 | }];
293 | }
294 |
295 |
296 | #pragma mark - UIScrollViewDelegte
297 |
298 | -(void)scrollViewDidScroll:(UIScrollView *)scrollView
299 | {
300 | if (self.containerView == scrollView){
301 | // pan direction
302 | XLSwipeDirection direction = XLSwipeDirectionNone;
303 | if (scrollView.contentOffset.x > _lastContentOffset){
304 | direction = XLSwipeDirectionLeft;
305 | }
306 | else if (scrollView.contentOffset.x < _lastContentOffset){
307 | direction = XLSwipeDirectionRight;
308 | }
309 | [self updateContent];
310 | }
311 | }
312 |
313 |
314 | -(void)scrollViewWillBeginDragging:(UIScrollView *)scrollView
315 | {
316 | if (self.containerView == scrollView){
317 | _lastPageNumber = [self pageForContentOffset:scrollView.contentOffset.x];
318 | _lastContentOffset = scrollView.contentOffset.x;
319 | }
320 | }
321 |
322 | -(void)scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView
323 | {
324 | if (self.containerView == scrollView && _originalSwipeViewControllers){
325 | _swipeViewControllers = _originalSwipeViewControllers;
326 | _originalSwipeViewControllers = nil;
327 | if (self.navigationController){
328 | self.navigationController.view.userInteractionEnabled = YES;
329 | }
330 | else{
331 | self.view.userInteractionEnabled = YES;
332 | }
333 | [self updateContent];
334 | }
335 | }
336 |
337 |
338 | #pragma mark - Properties
339 |
340 |
341 | -(NSUInteger)currentIndex
342 | {
343 | return _currentIndex;
344 | }
345 |
346 | -(void)setCurrentIndex:(NSUInteger)currentIndex
347 | {
348 | UIViewController * fromViewController = [self.swipeViewControllers objectAtIndex:_currentIndex];
349 | _currentIndex = currentIndex;
350 | // invoke delegate method
351 | if ([self.delegate respondsToSelector:@selector(swipeContainerController:updateIndicatorToViewController:fromViewController:)]){
352 | [self.delegate swipeContainerController:self updateIndicatorToViewController:[self.swipeViewControllers objectAtIndex:_currentIndex] fromViewController:fromViewController];
353 | }
354 | //
355 | }
356 |
357 | #pragma mark - Orientation
358 |
359 | -(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
360 | {
361 | _pageBeforeRotate = self.currentIndex;
362 | }
363 |
364 | -(void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
365 | {
366 | self.currentIndex = _pageBeforeRotate;
367 | self.containerView.contentSize = CGSizeMake(CGRectGetWidth(self.containerView.bounds) * self.swipeViewControllers.count, self.containerView.contentSize.height);
368 | [self.containerView setContentOffset:CGPointMake([self pageOffsetForChildIndex:_pageBeforeRotate], 0) animated:NO];
369 |
370 | [self updateContent];
371 | }
372 |
373 |
374 | @end
375 |
--------------------------------------------------------------------------------
/XLMailBoxContainer/XLMailBoxContainer-Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | UIStatusBarStyle
6 | UIStatusBarStyleLightContent
7 | UIViewControllerBasedStatusBarAppearance
8 |
9 | CFBundleDevelopmentRegion
10 | en
11 | LSApplicationCategoryType
12 |
13 | CFBundleDisplayName
14 | ${PRODUCT_NAME}
15 | CFBundleExecutable
16 | ${EXECUTABLE_NAME}
17 | CFBundleIdentifier
18 | com.xmartlabs.${PRODUCT_NAME:rfc1034identifier}
19 | CFBundleInfoDictionaryVersion
20 | 6.0
21 | CFBundleName
22 | ${PRODUCT_NAME}
23 | CFBundlePackageType
24 | APPL
25 | CFBundleShortVersionString
26 | 1.0
27 | CFBundleSignature
28 | ????
29 | CFBundleVersion
30 | 1.0
31 | LSRequiresIPhoneOS
32 |
33 | UIMainStoryboardFile
34 | Storyboard
35 | UIRequiredDeviceCapabilities
36 |
37 | armv7
38 |
39 | UISupportedInterfaceOrientations
40 |
41 | UIInterfaceOrientationPortrait
42 | UIInterfaceOrientationLandscapeLeft
43 | UIInterfaceOrientationLandscapeRight
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/XLMailBoxContainer/XLMailBoxContainer-Prefix.pch:
--------------------------------------------------------------------------------
1 | //
2 | // Prefix header
3 | //
4 | // The contents of this file are implicitly included at the beginning of every source file.
5 | //
6 |
7 | #import
8 |
9 | #ifndef __IPHONE_3_0
10 | #warning "This project uses features only available in iOS SDK 3.0 and later."
11 | #endif
12 |
13 | #ifdef __OBJC__
14 | #import
15 | #import
16 | #endif
17 |
--------------------------------------------------------------------------------
/XLMailBoxContainer/en.lproj/InfoPlist.strings:
--------------------------------------------------------------------------------
1 | /* Localized versions of Info.plist keys */
2 |
3 |
--------------------------------------------------------------------------------
/XLMailBoxContainer/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // XLMailBoxContainer
4 | //
5 | // Created by Martin Barreto on 2/26/14.
6 | // Copyright (c) 2014 Xmartlabs. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | #import "AppDelegate.h"
12 |
13 | int main(int argc, char * argv[])
14 | {
15 | @autoreleasepool {
16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/XLMailBoxContainerTests/XLMailBoxContainerTests-Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | ${EXECUTABLE_NAME}
9 | CFBundleIdentifier
10 | com.xmartlabs.${PRODUCT_NAME:rfc1034identifier}
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundlePackageType
14 | BNDL
15 | CFBundleShortVersionString
16 | 1.0
17 | CFBundleSignature
18 | ????
19 | CFBundleVersion
20 | 1
21 |
22 |
23 |
--------------------------------------------------------------------------------
/XLMailBoxContainerTests/XLMailBoxContainerTests.m:
--------------------------------------------------------------------------------
1 | //
2 | // XLMailBoxContainerTests.m
3 | // XLMailBoxContainerTests
4 | //
5 | // Created by Martin Barreto on 2/26/14.
6 | // Copyright (c) 2014 Xmartlabs. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface XLMailBoxContainerTests : XCTestCase
12 |
13 | @end
14 |
15 | @implementation XLMailBoxContainerTests
16 |
17 | - (void)setUp
18 | {
19 | [super setUp];
20 | // Put setup code here. This method is called before the invocation of each test method in the class.
21 | }
22 |
23 | - (void)tearDown
24 | {
25 | // Put teardown code here. This method is called after the invocation of each test method in the class.
26 | [super tearDown];
27 | }
28 |
29 | - (void)testExample
30 | {
31 | XCTFail(@"No implementation for \"%s\"", __PRETTY_FUNCTION__);
32 | }
33 |
34 | @end
35 |
--------------------------------------------------------------------------------
/XLMailBoxContainerTests/en.lproj/InfoPlist.strings:
--------------------------------------------------------------------------------
1 | /* Localized versions of Info.plist keys */
2 |
3 |
--------------------------------------------------------------------------------
/example.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xmartlabs/XLMailBoxContainer/2c2ca7e59f380aad3ba48ebc1960e97975e5702e/example.gif
--------------------------------------------------------------------------------