Initial commit

This commit is contained in:
Martin Barreto 2014-12-20 10:05:23 -02:00
parent 4a83b1a8e3
commit 33ad1fb015
78 changed files with 3792 additions and 0 deletions

3
Podfile Normal file
View File

@ -0,0 +1,3 @@
platform :ios, '7.0'
pod 'XLDataLoader', '~> 1.1', :inhibit_warnings => true

84
README.md Normal file
View File

@ -0,0 +1,84 @@
XLPagerTabStrip
---------------
By [XMARTLABS](http://xmartlabs.com).
Android [XLPagerTabStrip](http://developer.android.com/reference/android/support/v4/view/PagerTabStrip.html) for iOS!
**XLPagerTabStrip** is a *Container View Controller* that allows us to switch easily among a collection of view controllers. Pan gesture can be used to move on to next or previous view controller. It shows a interactive indicator of the current, previous, next child view controllers.
![Screenshot of native Calendar Event Example](XLPagerTabStrip/Demo/PagerSlidingTabStrip.gif)
Purpose
--------
**XLPagerTabStrip** helps us deal with view controllers that have the same relevance for the user like Android PagerTabStrip and PageView do. Since you're able to navigate between a large amount of view controllers, XLPagerTabStrip is an scalable and nice solution for this problem.
How to use it
--------------
Integrate `XLPagerTabStrip` is as easy as following these steps:
1. Create a UIViewController class that should extend from either `XLSegmentedPagerTabStripViewController`, `XLBarPagerTabStripViewController`, `XLButtonBarPagerTabStripViewController`.
2. The recently created concrete view controller should conform to `XLPagerTabStripViewControllerDataSource` implementing: `-(NSArray *)childViewControllersForPagerTabStripViewController:(XLPagerTabStripViewController *)pagerTabStripViewController;`
3. (Recomended) Set up your view controllers using a nib file or a Storyboard. We need to connect some IBOutlets (take a look at the [Demo folder](XLPagerTabStrip/Demo)).
4. Enjoy!
For further details take a look at the [Demo folder](XLPagerTabStrip/Demo) to see the code of examples shown above.
Installation
--------------------------
The easiest way to use `XLPagerTabStrip` in your app is via [CocoaPods](http://cocoapods.org/ "CocoaPods").
1. Add the following line in the project's Podfile file:
`pod 'XLPagerTabStrip', '~> 1.0.0'`.
2. Run the command `pod install` from the Podfile folder directory.
Customization
--------------
The most interesting customizable features are:
* Ability to skip intermediate view controllers when tapped on a "tab".
* Update the bar view indicator either when scroll offset changes or at the middle of the screen.
* Indicators can be added at any position of the screen through storyboard layouts.
* Add space padding between view controllers.
Requirements
-----------------------------
* ARC
* iOS 7.0 and above
Release Notes
--------------
Version 1.0.0 (cocoaPod)
* Initial release
Contributors
------------
* Martin Barreto - [@mtnBarreto](http://twitter.com/mtnBarreto)
* Washington Miranda
XLPagerTabStrip was inspired by [Tell Marquet](http://about.tellmarket.com/) app.
Contact
----------------
Any suggestion or question? Please create a Github issue or reach us out.
[xmartlabs.com](http://xmartlabs.com).
[@xmartlabs](http://twitter.com/xmartlabs "@xmartlabs")

15
XLPagerTabStrip.podspec Normal file
View File

@ -0,0 +1,15 @@
Pod::Spec.new do |s|
s.name = 'XLPagerTabStrip'
s.version = '1.0.0'
s.license = 'MIT'
s.summary = 'Android PagerTabStrip for iOS and much more!'
s.description = <<-DESC
DESC
s.homepage = 'https://github.com/xmartlabs/XLPagerTabStrip'
s.authors = { 'Martin Barreto' => 'martin@xmartlabs.com', 'Washington Miranda' => 'mirandaacevedo@gmail.com' }
s.source = { :git => 'https://github.com/xmartlabs/XLPagerTabStrip.git', :tag => 'v1.0.0' }
s.source_files = 'XLPagerTabStrip/XL/**/*.{h,m}'
s.requires_arc = true
s.ios.deployment_target = '7.0'
s.ios.frameworks = 'UIKit', 'Foundation'
end

View File

@ -0,0 +1,559 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
28B63A8C1A459F5900225C66 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 28B63A8B1A459F5900225C66 /* main.m */; };
28B63A8F1A459F5900225C66 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 28B63A8E1A459F5900225C66 /* AppDelegate.m */; };
28B63A971A459F5900225C66 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 28B63A961A459F5900225C66 /* Images.xcassets */; };
28B63AA61A459F5900225C66 /* XLPagerTabStripTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 28B63AA51A459F5900225C66 /* XLPagerTabStripTests.m */; };
28B63AC31A45A4C500225C66 /* BarExampleViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 28B63AB11A45A4C500225C66 /* BarExampleViewController.m */; };
28B63AC41A45A4C500225C66 /* ButtonBarExampleViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 28B63AB31A45A4C500225C66 /* ButtonBarExampleViewController.m */; };
28B63AC51A45A4C500225C66 /* MailBoxChildViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 28B63AB61A45A4C500225C66 /* MailBoxChildViewController.m */; };
28B63AC61A45A4C500225C66 /* MailBoxTableChildViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 28B63AB81A45A4C500225C66 /* MailBoxTableChildViewController.m */; };
28B63AC71A45A4C500225C66 /* PostCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 28B63ABB1A45A4C500225C66 /* PostCell.m */; };
28B63AC81A45A4C500225C66 /* XLJSONSerialization.m in Sources */ = {isa = PBXBuildFile; fileRef = 28B63ABE1A45A4C500225C66 /* XLJSONSerialization.m */; };
28B63AC91A45A4C500225C66 /* PagerSlidingTabStrip.gif in Resources */ = {isa = PBXBuildFile; fileRef = 28B63ABF1A45A4C500225C66 /* PagerSlidingTabStrip.gif */; };
28B63ACA1A45A4C500225C66 /* SegmentedExampleViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 28B63AC11A45A4C500225C66 /* SegmentedExampleViewController.m */; };
28B63ACB1A45A4C500225C66 /* Storyboard.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 28B63AC21A45A4C500225C66 /* Storyboard.storyboard */; };
28B63ADC1A45A4CD00225C66 /* XLBarView.m in Sources */ = {isa = PBXBuildFile; fileRef = 28B63ACF1A45A4CD00225C66 /* XLBarView.m */; };
28B63ADD1A45A4CD00225C66 /* XLButtonBarView.m in Sources */ = {isa = PBXBuildFile; fileRef = 28B63AD11A45A4CD00225C66 /* XLButtonBarView.m */; };
28B63ADE1A45A4CD00225C66 /* XLButtonBarViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 28B63AD31A45A4CD00225C66 /* XLButtonBarViewCell.m */; };
28B63AE51A45A8EE00225C66 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 28B63AE31A45A8EE00225C66 /* LaunchScreen.xib */; };
28B63AEF1A45B26600225C66 /* XLBarPagerTabStripViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 28B63AE81A45B26600225C66 /* XLBarPagerTabStripViewController.m */; };
28B63AF01A45B26600225C66 /* XLButtonBarPagerTabStripViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 28B63AEA1A45B26600225C66 /* XLButtonBarPagerTabStripViewController.m */; };
28B63AF11A45B26600225C66 /* XLPagerTabStripViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 28B63AEC1A45B26600225C66 /* XLPagerTabStripViewController.m */; };
28B63AF21A45B26600225C66 /* XLSegmentedPagerTabStripViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 28B63AEE1A45B26600225C66 /* XLSegmentedPagerTabStripViewController.m */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
28B63AA01A459F5900225C66 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 28B63A7E1A459F5900225C66 /* Project object */;
proxyType = 1;
remoteGlobalIDString = 28B63A851A459F5900225C66;
remoteInfo = XLPagerTabStrip;
};
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
28B63A861A459F5900225C66 /* XLPagerTabStrip.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = XLPagerTabStrip.app; sourceTree = BUILT_PRODUCTS_DIR; };
28B63A8A1A459F5900225C66 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
28B63A8B1A459F5900225C66 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
28B63A8D1A459F5900225C66 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
28B63A8E1A459F5900225C66 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
28B63A961A459F5900225C66 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
28B63A9F1A459F5900225C66 /* XLPagerTabStripTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = XLPagerTabStripTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
28B63AA41A459F5900225C66 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
28B63AA51A459F5900225C66 /* XLPagerTabStripTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XLPagerTabStripTests.m; sourceTree = "<group>"; };
28B63AB01A45A4C500225C66 /* BarExampleViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BarExampleViewController.h; sourceTree = "<group>"; };
28B63AB11A45A4C500225C66 /* BarExampleViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BarExampleViewController.m; sourceTree = "<group>"; };
28B63AB21A45A4C500225C66 /* ButtonBarExampleViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ButtonBarExampleViewController.h; sourceTree = "<group>"; };
28B63AB31A45A4C500225C66 /* ButtonBarExampleViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ButtonBarExampleViewController.m; sourceTree = "<group>"; };
28B63AB51A45A4C500225C66 /* MailBoxChildViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MailBoxChildViewController.h; sourceTree = "<group>"; };
28B63AB61A45A4C500225C66 /* MailBoxChildViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MailBoxChildViewController.m; sourceTree = "<group>"; };
28B63AB71A45A4C500225C66 /* MailBoxTableChildViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MailBoxTableChildViewController.h; sourceTree = "<group>"; };
28B63AB81A45A4C500225C66 /* MailBoxTableChildViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MailBoxTableChildViewController.m; sourceTree = "<group>"; };
28B63ABA1A45A4C500225C66 /* PostCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PostCell.h; sourceTree = "<group>"; };
28B63ABB1A45A4C500225C66 /* PostCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PostCell.m; sourceTree = "<group>"; };
28B63ABD1A45A4C500225C66 /* XLJSONSerialization.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XLJSONSerialization.h; sourceTree = "<group>"; };
28B63ABE1A45A4C500225C66 /* XLJSONSerialization.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XLJSONSerialization.m; sourceTree = "<group>"; };
28B63ABF1A45A4C500225C66 /* PagerSlidingTabStrip.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = PagerSlidingTabStrip.gif; sourceTree = "<group>"; };
28B63AC01A45A4C500225C66 /* SegmentedExampleViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SegmentedExampleViewController.h; sourceTree = "<group>"; };
28B63AC11A45A4C500225C66 /* SegmentedExampleViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SegmentedExampleViewController.m; sourceTree = "<group>"; };
28B63AC21A45A4C500225C66 /* Storyboard.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Storyboard.storyboard; sourceTree = "<group>"; };
28B63ACE1A45A4CD00225C66 /* XLBarView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XLBarView.h; sourceTree = "<group>"; };
28B63ACF1A45A4CD00225C66 /* XLBarView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XLBarView.m; sourceTree = "<group>"; };
28B63AD01A45A4CD00225C66 /* XLButtonBarView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XLButtonBarView.h; sourceTree = "<group>"; };
28B63AD11A45A4CD00225C66 /* XLButtonBarView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XLButtonBarView.m; sourceTree = "<group>"; };
28B63AD21A45A4CD00225C66 /* XLButtonBarViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XLButtonBarViewCell.h; sourceTree = "<group>"; };
28B63AD31A45A4CD00225C66 /* XLButtonBarViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XLButtonBarViewCell.m; sourceTree = "<group>"; };
28B63AE41A45A8EE00225C66 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = XLPagerTabStrip/Base.lproj/LaunchScreen.xib; sourceTree = SOURCE_ROOT; };
28B63AE71A45B26600225C66 /* XLBarPagerTabStripViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = XLBarPagerTabStripViewController.h; path = Controllers/XLBarPagerTabStripViewController.h; sourceTree = "<group>"; };
28B63AE81A45B26600225C66 /* XLBarPagerTabStripViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = XLBarPagerTabStripViewController.m; path = Controllers/XLBarPagerTabStripViewController.m; sourceTree = "<group>"; };
28B63AE91A45B26600225C66 /* XLButtonBarPagerTabStripViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = XLButtonBarPagerTabStripViewController.h; path = Controllers/XLButtonBarPagerTabStripViewController.h; sourceTree = "<group>"; };
28B63AEA1A45B26600225C66 /* XLButtonBarPagerTabStripViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = XLButtonBarPagerTabStripViewController.m; path = Controllers/XLButtonBarPagerTabStripViewController.m; sourceTree = "<group>"; };
28B63AEB1A45B26600225C66 /* XLPagerTabStripViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = XLPagerTabStripViewController.h; path = Controllers/XLPagerTabStripViewController.h; sourceTree = "<group>"; };
28B63AEC1A45B26600225C66 /* XLPagerTabStripViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = XLPagerTabStripViewController.m; path = Controllers/XLPagerTabStripViewController.m; sourceTree = "<group>"; };
28B63AED1A45B26600225C66 /* XLSegmentedPagerTabStripViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = XLSegmentedPagerTabStripViewController.h; path = Controllers/XLSegmentedPagerTabStripViewController.h; sourceTree = "<group>"; };
28B63AEE1A45B26600225C66 /* XLSegmentedPagerTabStripViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = XLSegmentedPagerTabStripViewController.m; path = Controllers/XLSegmentedPagerTabStripViewController.m; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
28B63A831A459F5900225C66 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
28B63A9C1A459F5900225C66 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
28B63A7D1A459F5900225C66 = {
isa = PBXGroup;
children = (
28B63A881A459F5900225C66 /* XLPagerTabStrip */,
28B63AA21A459F5900225C66 /* XLPagerTabStripTests */,
28B63A871A459F5900225C66 /* Products */,
);
sourceTree = "<group>";
};
28B63A871A459F5900225C66 /* Products */ = {
isa = PBXGroup;
children = (
28B63A861A459F5900225C66 /* XLPagerTabStrip.app */,
28B63A9F1A459F5900225C66 /* XLPagerTabStripTests.xctest */,
);
name = Products;
sourceTree = "<group>";
};
28B63A881A459F5900225C66 /* XLPagerTabStrip */ = {
isa = PBXGroup;
children = (
28B63ACC1A45A4CD00225C66 /* XL */,
28B63AAF1A45A4C500225C66 /* Demo */,
28B63A8D1A459F5900225C66 /* AppDelegate.h */,
28B63A8E1A459F5900225C66 /* AppDelegate.m */,
28B63A961A459F5900225C66 /* Images.xcassets */,
28B63A891A459F5900225C66 /* Supporting Files */,
);
path = XLPagerTabStrip;
sourceTree = "<group>";
};
28B63A891A459F5900225C66 /* Supporting Files */ = {
isa = PBXGroup;
children = (
28B63A8A1A459F5900225C66 /* Info.plist */,
28B63A8B1A459F5900225C66 /* main.m */,
);
name = "Supporting Files";
sourceTree = "<group>";
};
28B63AA21A459F5900225C66 /* XLPagerTabStripTests */ = {
isa = PBXGroup;
children = (
28B63AA51A459F5900225C66 /* XLPagerTabStripTests.m */,
28B63AA31A459F5900225C66 /* Supporting Files */,
);
path = XLPagerTabStripTests;
sourceTree = "<group>";
};
28B63AA31A459F5900225C66 /* Supporting Files */ = {
isa = PBXGroup;
children = (
28B63AA41A459F5900225C66 /* Info.plist */,
);
name = "Supporting Files";
sourceTree = "<group>";
};
28B63AAF1A45A4C500225C66 /* Demo */ = {
isa = PBXGroup;
children = (
28B63AE31A45A8EE00225C66 /* LaunchScreen.xib */,
28B63AB01A45A4C500225C66 /* BarExampleViewController.h */,
28B63AB11A45A4C500225C66 /* BarExampleViewController.m */,
28B63AB21A45A4C500225C66 /* ButtonBarExampleViewController.h */,
28B63AB31A45A4C500225C66 /* ButtonBarExampleViewController.m */,
28B63AB41A45A4C500225C66 /* ChildViewController */,
28B63ABC1A45A4C500225C66 /* Helpers */,
28B63ABF1A45A4C500225C66 /* PagerSlidingTabStrip.gif */,
28B63AC01A45A4C500225C66 /* SegmentedExampleViewController.h */,
28B63AC11A45A4C500225C66 /* SegmentedExampleViewController.m */,
28B63AC21A45A4C500225C66 /* Storyboard.storyboard */,
);
path = Demo;
sourceTree = "<group>";
};
28B63AB41A45A4C500225C66 /* ChildViewController */ = {
isa = PBXGroup;
children = (
28B63AB51A45A4C500225C66 /* MailBoxChildViewController.h */,
28B63AB61A45A4C500225C66 /* MailBoxChildViewController.m */,
28B63AB71A45A4C500225C66 /* MailBoxTableChildViewController.h */,
28B63AB81A45A4C500225C66 /* MailBoxTableChildViewController.m */,
28B63AB91A45A4C500225C66 /* Views */,
);
path = ChildViewController;
sourceTree = "<group>";
};
28B63AB91A45A4C500225C66 /* Views */ = {
isa = PBXGroup;
children = (
28B63ABA1A45A4C500225C66 /* PostCell.h */,
28B63ABB1A45A4C500225C66 /* PostCell.m */,
);
path = Views;
sourceTree = "<group>";
};
28B63ABC1A45A4C500225C66 /* Helpers */ = {
isa = PBXGroup;
children = (
28B63ABD1A45A4C500225C66 /* XLJSONSerialization.h */,
28B63ABE1A45A4C500225C66 /* XLJSONSerialization.m */,
);
path = Helpers;
sourceTree = "<group>";
};
28B63ACC1A45A4CD00225C66 /* XL */ = {
isa = PBXGroup;
children = (
28B63AE61A45B24100225C66 /* Controllers */,
28B63ACD1A45A4CD00225C66 /* Views */,
);
path = XL;
sourceTree = "<group>";
};
28B63ACD1A45A4CD00225C66 /* Views */ = {
isa = PBXGroup;
children = (
28B63ACE1A45A4CD00225C66 /* XLBarView.h */,
28B63ACF1A45A4CD00225C66 /* XLBarView.m */,
28B63AD01A45A4CD00225C66 /* XLButtonBarView.h */,
28B63AD11A45A4CD00225C66 /* XLButtonBarView.m */,
28B63AD21A45A4CD00225C66 /* XLButtonBarViewCell.h */,
28B63AD31A45A4CD00225C66 /* XLButtonBarViewCell.m */,
);
path = Views;
sourceTree = "<group>";
};
28B63AE61A45B24100225C66 /* Controllers */ = {
isa = PBXGroup;
children = (
28B63AE71A45B26600225C66 /* XLBarPagerTabStripViewController.h */,
28B63AE81A45B26600225C66 /* XLBarPagerTabStripViewController.m */,
28B63AE91A45B26600225C66 /* XLButtonBarPagerTabStripViewController.h */,
28B63AEA1A45B26600225C66 /* XLButtonBarPagerTabStripViewController.m */,
28B63AEB1A45B26600225C66 /* XLPagerTabStripViewController.h */,
28B63AEC1A45B26600225C66 /* XLPagerTabStripViewController.m */,
28B63AED1A45B26600225C66 /* XLSegmentedPagerTabStripViewController.h */,
28B63AEE1A45B26600225C66 /* XLSegmentedPagerTabStripViewController.m */,
);
name = Controllers;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
28B63A851A459F5900225C66 /* XLPagerTabStrip */ = {
isa = PBXNativeTarget;
buildConfigurationList = 28B63AA91A459F5900225C66 /* Build configuration list for PBXNativeTarget "XLPagerTabStrip" */;
buildPhases = (
28B63A821A459F5900225C66 /* Sources */,
28B63A831A459F5900225C66 /* Frameworks */,
28B63A841A459F5900225C66 /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = XLPagerTabStrip;
productName = XLPagerTabStrip;
productReference = 28B63A861A459F5900225C66 /* XLPagerTabStrip.app */;
productType = "com.apple.product-type.application";
};
28B63A9E1A459F5900225C66 /* XLPagerTabStripTests */ = {
isa = PBXNativeTarget;
buildConfigurationList = 28B63AAC1A459F5900225C66 /* Build configuration list for PBXNativeTarget "XLPagerTabStripTests" */;
buildPhases = (
28B63A9B1A459F5900225C66 /* Sources */,
28B63A9C1A459F5900225C66 /* Frameworks */,
28B63A9D1A459F5900225C66 /* Resources */,
);
buildRules = (
);
dependencies = (
28B63AA11A459F5900225C66 /* PBXTargetDependency */,
);
name = XLPagerTabStripTests;
productName = XLPagerTabStripTests;
productReference = 28B63A9F1A459F5900225C66 /* XLPagerTabStripTests.xctest */;
productType = "com.apple.product-type.bundle.unit-test";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
28B63A7E1A459F5900225C66 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0610;
ORGANIZATIONNAME = Xmartlabs;
TargetAttributes = {
28B63A851A459F5900225C66 = {
CreatedOnToolsVersion = 6.1.1;
};
28B63A9E1A459F5900225C66 = {
CreatedOnToolsVersion = 6.1.1;
TestTargetID = 28B63A851A459F5900225C66;
};
};
};
buildConfigurationList = 28B63A811A459F5900225C66 /* Build configuration list for PBXProject "XLPagerTabStrip" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 28B63A7D1A459F5900225C66;
productRefGroup = 28B63A871A459F5900225C66 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
28B63A851A459F5900225C66 /* XLPagerTabStrip */,
28B63A9E1A459F5900225C66 /* XLPagerTabStripTests */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
28B63A841A459F5900225C66 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
28B63AE51A45A8EE00225C66 /* LaunchScreen.xib in Resources */,
28B63AC91A45A4C500225C66 /* PagerSlidingTabStrip.gif in Resources */,
28B63A971A459F5900225C66 /* Images.xcassets in Resources */,
28B63ACB1A45A4C500225C66 /* Storyboard.storyboard in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
28B63A9D1A459F5900225C66 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
28B63A821A459F5900225C66 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
28B63AC51A45A4C500225C66 /* MailBoxChildViewController.m in Sources */,
28B63AF11A45B26600225C66 /* XLPagerTabStripViewController.m in Sources */,
28B63AC41A45A4C500225C66 /* ButtonBarExampleViewController.m in Sources */,
28B63ADC1A45A4CD00225C66 /* XLBarView.m in Sources */,
28B63AC81A45A4C500225C66 /* XLJSONSerialization.m in Sources */,
28B63ADD1A45A4CD00225C66 /* XLButtonBarView.m in Sources */,
28B63AC71A45A4C500225C66 /* PostCell.m in Sources */,
28B63ACA1A45A4C500225C66 /* SegmentedExampleViewController.m in Sources */,
28B63ADE1A45A4CD00225C66 /* XLButtonBarViewCell.m in Sources */,
28B63A8F1A459F5900225C66 /* AppDelegate.m in Sources */,
28B63AF21A45B26600225C66 /* XLSegmentedPagerTabStripViewController.m in Sources */,
28B63AEF1A45B26600225C66 /* XLBarPagerTabStripViewController.m in Sources */,
28B63AC31A45A4C500225C66 /* BarExampleViewController.m in Sources */,
28B63AF01A45B26600225C66 /* XLButtonBarPagerTabStripViewController.m in Sources */,
28B63A8C1A459F5900225C66 /* main.m in Sources */,
28B63AC61A45A4C500225C66 /* MailBoxTableChildViewController.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
28B63A9B1A459F5900225C66 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
28B63AA61A459F5900225C66 /* XLPagerTabStripTests.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
28B63AA11A459F5900225C66 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 28B63A851A459F5900225C66 /* XLPagerTabStrip */;
targetProxy = 28B63AA01A459F5900225C66 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin PBXVariantGroup section */
28B63AE31A45A8EE00225C66 /* LaunchScreen.xib */ = {
isa = PBXVariantGroup;
children = (
28B63AE41A45A8EE00225C66 /* Base */,
);
name = LaunchScreen.xib;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
28B63AA71A459F5900225C66 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.1;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
};
name = Debug;
};
28B63AA81A459F5900225C66 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = YES;
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.1;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
VALIDATE_PRODUCT = YES;
};
name = Release;
};
28B63AAA1A459F5900225C66 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
INFOPLIST_FILE = XLPagerTabStrip/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Debug;
};
28B63AAB1A459F5900225C66 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
INFOPLIST_FILE = XLPagerTabStrip/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Release;
};
28B63AAD1A459F5900225C66 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
FRAMEWORK_SEARCH_PATHS = (
"$(SDKROOT)/Developer/Library/Frameworks",
"$(inherited)",
);
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
INFOPLIST_FILE = XLPagerTabStripTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/XLPagerTabStrip.app/XLPagerTabStrip";
};
name = Debug;
};
28B63AAE1A459F5900225C66 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
FRAMEWORK_SEARCH_PATHS = (
"$(SDKROOT)/Developer/Library/Frameworks",
"$(inherited)",
);
INFOPLIST_FILE = XLPagerTabStripTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/XLPagerTabStrip.app/XLPagerTabStrip";
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
28B63A811A459F5900225C66 /* Build configuration list for PBXProject "XLPagerTabStrip" */ = {
isa = XCConfigurationList;
buildConfigurations = (
28B63AA71A459F5900225C66 /* Debug */,
28B63AA81A459F5900225C66 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
28B63AA91A459F5900225C66 /* Build configuration list for PBXNativeTarget "XLPagerTabStrip" */ = {
isa = XCConfigurationList;
buildConfigurations = (
28B63AAA1A459F5900225C66 /* Debug */,
28B63AAB1A459F5900225C66 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
28B63AAC1A459F5900225C66 /* Build configuration list for PBXNativeTarget "XLPagerTabStripTests" */ = {
isa = XCConfigurationList;
buildConfigurations = (
28B63AAD1A459F5900225C66 /* Debug */,
28B63AAE1A459F5900225C66 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 28B63A7E1A459F5900225C66 /* Project object */;
}

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:XLPagerTabStrip.xcodeproj">
</FileRef>
</Workspace>

View File

@ -0,0 +1,32 @@
//
// AppDelegate.h
// XLPagerTabStrip ( https://github.com/xmartlabs/XLPagerTabStrip )
//
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end

View File

@ -0,0 +1,43 @@
//
// AppDelegate.m
// XLPagerTabStrip ( https://github.com/xmartlabs/XLPagerTabStrip )
//
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "XLJSONSerialization.h"
#import "XLSegmentedPagerTabStripViewController.h"
#import "MailBoxChildViewController.h"
#import "MailBoxTableChildViewController.h"
#import "AppDelegate.h"
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[[XLJSONSerialization sharedInstance] postsData];
return YES;
}
@end

View File

@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="6254" systemVersion="14B25" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6247"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="iN0-l3-epB">
<rect key="frame" x="0.0" y="0.0" width="480" height="480"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="Launch" translatesAutoresizingMaskIntoConstraints="NO" id="NkA-U4-RZl">
<rect key="frame" x="0.0" y="0.0" width="480" height="480"/>
</imageView>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text=" Copyright (c) 2014 Xmartlabs. All rights reserved." textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="9" translatesAutoresizingMaskIntoConstraints="NO" id="8ie-xW-0ye">
<rect key="frame" x="20" y="439" width="441" height="20.5"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="trailing" secondItem="NkA-U4-RZl" secondAttribute="trailing" id="2kN-tI-cuc"/>
<constraint firstItem="NkA-U4-RZl" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="8Np-Vu-8hW"/>
<constraint firstAttribute="bottom" secondItem="NkA-U4-RZl" secondAttribute="bottom" id="HXV-rG-WGN"/>
<constraint firstAttribute="bottom" secondItem="8ie-xW-0ye" secondAttribute="bottom" constant="20" id="Kzo-t9-V3l"/>
<constraint firstItem="8ie-xW-0ye" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="20" symbolic="YES" id="MfP-vx-nX0"/>
<constraint firstAttribute="centerX" secondItem="8ie-xW-0ye" secondAttribute="centerX" id="ZEH-qu-HZ9"/>
<constraint firstItem="NkA-U4-RZl" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" id="cdN-6v-tPa"/>
<constraint firstItem="8ie-xW-0ye" firstAttribute="top" secondItem="NkA-U4-RZl" secondAttribute="bottom" id="ub4-QB-81e"/>
</constraints>
<nil key="simulatedStatusBarMetrics"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<variation key="default">
<mask key="constraints">
<exclude reference="ub4-QB-81e"/>
</mask>
</variation>
<point key="canvasLocation" x="548" y="455"/>
</view>
</objects>
<resources>
<image name="Launch" width="320" height="568"/>
</resources>
</document>

View File

@ -0,0 +1,31 @@
//
// BarContainerViewController.h
// XLPagerTabStrip ( https://github.com/xmartlabs/XLPagerTabStrip )
//
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "XLBarPagerTabStripViewController.h"
#import "XLPagerTabStripViewController.h"
@interface BarExampleViewController : XLBarPagerTabStripViewController
@end

View File

@ -0,0 +1,64 @@
//
// BarContainerViewController.m
// XLPagerTabStrip ( https://github.com/xmartlabs/XLPagerTabStrip )
//
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "MailBoxTableChildViewController.h"
#import "MailBoxChildViewController.h"
#import "BarExampleViewController.h"
@interface BarExampleViewController ()
@end
@implementation BarExampleViewController
- (instancetype)initWithCoder:(NSCoder *)coder
{
self = [super initWithCoder:coder];
if (self) {
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
[self.barView.selectedBar setBackgroundColor:[UIColor orangeColor]];
}
#pragma mark - XLPagerTabStripViewControllerDataSource
-(NSArray *)childViewControllersForPagerTabStripViewController:(XLPagerTabStripViewController *)pagerTabStripViewController
{
// create child view controllers that will be managed by XLPagerTabStripViewController
MailBoxTableChildViewController * child_1 = [[MailBoxTableChildViewController alloc] initWithStyle:UITableViewStylePlain];
MailBoxChildViewController * child_2 = [[MailBoxChildViewController alloc] init];
MailBoxTableChildViewController * child_3 = [[MailBoxTableChildViewController alloc] initWithStyle:UITableViewStyleGrouped];
MailBoxChildViewController * child_4 = [[MailBoxChildViewController alloc] init];
return @[child_1, child_2, child_3, child_4];
}
@end

View File

@ -0,0 +1,30 @@
//
// ButtonContainerViewController.h
// XLPagerTabStrip ( https://github.com/xmartlabs/XLPagerTabStrip )
//
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "XLButtonBarPagerTabStripViewController.h"
@interface ButtonBarExampleViewController : XLButtonBarPagerTabStripViewController
@end

View File

@ -0,0 +1,58 @@
//
// ButtonContainerViewController.m
// XLPagerTabStrip ( https://github.com/xmartlabs/XLPagerTabStrip )
//
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "MailBoxTableChildViewController.h"
#import "MailBoxChildViewController.h"
#import "ButtonBarExampleViewController.h"
@interface ButtonBarExampleViewController ()
@end
@implementation ButtonBarExampleViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
[self.buttonBarView.selectedBar setBackgroundColor:[UIColor orangeColor]];
}
#pragma mark - XLPagerTabStripViewControllerDataSource
-(NSArray *)childViewControllersForPagerTabStripViewController:(XLPagerTabStripViewController *)pagerTabStripViewController
{
// create child view controllers that will be managed by XLPagerTabStripViewController
MailBoxTableChildViewController * child_1 = [[MailBoxTableChildViewController alloc] initWithStyle:UITableViewStylePlain];
MailBoxChildViewController * child_2 = [[MailBoxChildViewController alloc] init];
MailBoxTableChildViewController * child_3 = [[MailBoxTableChildViewController alloc] initWithStyle:UITableViewStyleGrouped];
MailBoxChildViewController * child_4 = [[MailBoxChildViewController alloc] init];
MailBoxTableChildViewController * child_5 = [[MailBoxTableChildViewController alloc] initWithStyle:UITableViewStylePlain];
MailBoxChildViewController * child_6 = [[MailBoxChildViewController alloc] init];
MailBoxTableChildViewController * child_7 = [[MailBoxTableChildViewController alloc] initWithStyle:UITableViewStyleGrouped];
MailBoxChildViewController * child_8 = [[MailBoxChildViewController alloc] init];
return @[child_1, child_2, child_3, child_4, child_5, child_6, child_7, child_8];
}
@end

View File

@ -0,0 +1,31 @@
//
// MailBoxChildViewController.h
// XLPagerTabStrip ( https://github.com/xmartlabs/XLPagerTabStrip )
//
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "XLPagerTabStripViewController.h"
#import <UIKit/UIKit.h>
@interface MailBoxChildViewController : UIViewController <XLPagerTabStripChildItem>
@end

View File

@ -0,0 +1,72 @@
//
// MailBoxChildViewController.m
// XLPagerTabStrip ( https://github.com/xmartlabs/XLPagerTabStrip )
//
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "MailBoxChildViewController.h"
@implementation MailBoxChildViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
[self.view setBackgroundColor:[UIColor whiteColor]];
// Do any additional setup after loading the view.
UILabel * label = [[UILabel alloc] init];
[label setTranslatesAutoresizingMaskIntoConstraints:NO];
label.text = @"XLPagerTabStrip";
[self.view addSubview:label];
[self.view addConstraint:[NSLayoutConstraint constraintWithItem:label attribute:NSLayoutAttributeCenterX relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeCenterX multiplier:1.0 constant:0.0]];
[self.view addConstraint:[NSLayoutConstraint constraintWithItem:label attribute:NSLayoutAttributeCenterY relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeCenterY multiplier:1.0 constant:-50.0]];
}
-(void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
}
#pragma mark - XLPagerTabStripViewControllerDelegate
-(NSString *)titleForPagerTabStripViewController:(XLPagerTabStripViewController *)pagerTabStripViewController
{
return @"View";
}
-(UIColor *)colorForPagerTabStripViewController:(XLPagerTabStripViewController *)pagerTabStripViewController
{
return [UIColor whiteColor];
}
@end

View File

@ -0,0 +1,32 @@
//
// MailBoxTableChildViewController.h
// XLPagerTabStrip ( https://github.com/xmartlabs/XLPagerTabStrip )
//
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <UIKit/UIKit.h>
#import "XLPagerTabStripViewController.h"
@interface MailBoxTableChildViewController : UITableViewController <XLPagerTabStripChildItem>
@end

View File

@ -0,0 +1,167 @@
//
// MailBoxTableChildViewController.m
// XLPagerTabStrip ( https://github.com/xmartlabs/XLPagerTabStrip )
//
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "XLJSONSerialization.h"
#import "PostCell.h"
#import "MailBoxTableChildViewController.h"
NSString *const kCellIdentifier = @"PostCell";
@implementation MailBoxTableChildViewController
{
NSArray * _posts;
PostCell * _offScreenCell;
}
- (id)initWithStyle:(UITableViewStyle)style
{
self = [super initWithStyle:style];
if (self) {
_posts = [[XLJSONSerialization sharedInstance] postsData];
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
[self.tableView registerClass:[PostCell class] forCellReuseIdentifier:kCellIdentifier];
}
-(void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
}
#pragma mark - Table view data source
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return _posts.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
PostCell *cell = (PostCell *) [tableView dequeueReusableCellWithIdentifier:kCellIdentifier forIndexPath:indexPath];
cell.userName.text = [_posts objectAtIndex:indexPath.row][@"post"][@"user"][@"name"];
cell.postDate.text = [self timeAgo:[self dateFromString:[_posts objectAtIndex:indexPath.row][@"post"][@"created_at"]]];
cell.postText.text = [_posts objectAtIndex:indexPath.row][@"post"][@"text"];
[cell.postText setPreferredMaxLayoutWidth:self.view.bounds.size.width];
[cell.userImage setImage:[UIImage imageNamed:[cell.userName.text stringByReplacingOccurrencesOfString:@" " withString:@"_"]]];
return cell;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
if (!_offScreenCell)
{
_offScreenCell = (PostCell *)[self.tableView dequeueReusableCellWithIdentifier:kCellIdentifier];
// Dummy Data
_offScreenCell.userName.text = @"offscreen name";
_offScreenCell.postDate.text = @"7m";
[_offScreenCell.userImage setImage:[UIImage imageNamed:@"default-avatar"]];
}
_offScreenCell.postText.text = [_posts objectAtIndex:indexPath.row][@"post"][@"text"];
[_offScreenCell.postText setPreferredMaxLayoutWidth:self.view.bounds.size.width];
[_offScreenCell.contentView setNeedsLayout];
[_offScreenCell.contentView layoutIfNeeded];
CGSize size = [_offScreenCell.contentView systemLayoutSizeFittingSize:UILayoutFittingCompressedSize];
return size.height + 1;
}
#pragma mark - XLPagerTabStripViewControllerDelegate
-(NSString *)titleForPagerTabStripViewController:(XLPagerTabStripViewController *)pagerTabStripViewController
{
return @"Table View";
}
-(UIColor *)colorForPagerTabStripViewController:(XLPagerTabStripViewController *)pagerTabStripViewController
{
return [UIColor whiteColor];
}
#pragma mark - Helpers
#define SECONDS_IN_A_MINUTE 60
#define SECONDS_IN_A_HOUR 3600
#define SECONDS_IN_A_DAY 86400
#define SECONDS_IN_A_MONTH_OF_30_DAYS 2592000
#define SECONDS_IN_A_YEAR_OF_MONTH_OF_30_DAYS 31104000
- (NSString *)timeAgo:(NSDate *)date {
NSTimeInterval distanceBetweenDates = [date timeIntervalSinceDate:[NSDate date]] * (-1);
int distance = (int)floorf(distanceBetweenDates);
if (distance <= 0) {
return @"now";
}
else if (distance < SECONDS_IN_A_MINUTE) {
return [NSString stringWithFormat:@"%ds", distance];
}
else if (distance < SECONDS_IN_A_HOUR) {
distance = distance / SECONDS_IN_A_MINUTE;
return [NSString stringWithFormat:@"%dm", distance];
}
else if (distance < SECONDS_IN_A_DAY) {
distance = distance / SECONDS_IN_A_HOUR;
return [NSString stringWithFormat:@"%dh", distance];
}
else if (distance < SECONDS_IN_A_MONTH_OF_30_DAYS) {
distance = distance / SECONDS_IN_A_DAY;
return [NSString stringWithFormat:@"%dd", distance];
}
else if (distance < SECONDS_IN_A_YEAR_OF_MONTH_OF_30_DAYS) {
distance = distance / SECONDS_IN_A_MONTH_OF_30_DAYS;
return [NSString stringWithFormat:@"%dmo", distance];
} else {
distance = distance / SECONDS_IN_A_YEAR_OF_MONTH_OF_30_DAYS;
return [NSString stringWithFormat:@"%dy", distance];
}
}
-(NSDate *)dateFromString:(NSString *)dateString
{
// date formatter
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setTimeZone:[NSTimeZone timeZoneWithName:@"UTC"]];
[formatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ss"];
// hot fix from date
NSRange range = [dateString rangeOfString:@"."];
if (range.location != NSNotFound){
dateString = [dateString substringToIndex:range.location];
}
return [formatter dateFromString:dateString];
}
@end

View File

@ -0,0 +1,40 @@
//
// PostCell.h
// XLPagerTabStrip ( https://github.com/xmartlabs/XLPagerTabStrip )
//
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <UIKit/UIKit.h>
@interface PostTextLabel : UILabel
@end
@interface PostCell : UITableViewCell
@property (nonatomic) UIImageView * userImage;
@property (nonatomic) UILabel * userName;
@property (nonatomic) PostTextLabel * postText;
@property (nonatomic) UILabel * postDate;
@end

View File

@ -0,0 +1,159 @@
//
// PostCell.m
// XLPagerTabStrip ( https://github.com/xmartlabs/XLPagerTabStrip )
//
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "PostCell.h"
@implementation PostCell
@synthesize userImage = _userImage;
@synthesize userName = _userName;
@synthesize postText = _postText;
@synthesize postDate = _postDate;
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
// Initialization code
[self.contentView addSubview:self.userImage];
[self.contentView addSubview:self.userName];
[self.contentView addSubview:self.postText];
[self.contentView addSubview:self.postDate];
[self.contentView addConstraints:[self layoutConstraints]];
}
return self;
}
#pragma mark - Views
-(UIImageView *)userImage
{
if (_userImage) return _userImage;
_userImage = [UIImageView new];
[_userImage setTranslatesAutoresizingMaskIntoConstraints:NO];
_userImage.layer.masksToBounds = YES;
_userImage.layer.cornerRadius = 10.0f;
return _userImage;
}
-(UILabel *)userName
{
if (_userName) return _userName;
_userName = [UILabel new];
[_userName setTranslatesAutoresizingMaskIntoConstraints:NO];
_userName.font = [UIFont fontWithName:@"HelveticaNeue" size:15];
[_userName setContentCompressionResistancePriority:500 forAxis:UILayoutConstraintAxisHorizontal];
return _userName;
}
-(PostTextLabel *)postText
{
if (_postText) return _postText;
_postText = [PostTextLabel new];
[_postText setTranslatesAutoresizingMaskIntoConstraints:NO];
_postText.font = [UIFont fontWithName:@"HelveticaNeue" size:12];
_postText.lineBreakMode = NSLineBreakByWordWrapping;
_postText.numberOfLines = 0;
return _postText;
}
-(UILabel *)postDate
{
if (_postDate) return _postDate;
_postDate = [UILabel new];
[_postDate setTranslatesAutoresizingMaskIntoConstraints:NO];
_postDate.textColor = [UIColor grayColor];
_postDate.font = [UIFont fontWithName:@"HelveticaNeue" size:12];
[_postDate setTextAlignment:NSTextAlignmentRight];
return _postDate;
}
#pragma mark - Layout Constraints
-(NSArray *)layoutConstraints{
NSMutableArray * result = [NSMutableArray array];
NSDictionary * views = @{ @"image": self.userImage,
@"name": self.userName,
@"text": self.postText,
@"date" : self.postDate };
NSDictionary *metrics = @{@"imgSize":@50.0,
@"margin" :@12.0};
[result addObjectsFromArray:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-(margin)-[image(imgSize)]-[name]"
options:NSLayoutFormatAlignAllTop
metrics:metrics
views:views]];
[result addObjectsFromArray:[NSLayoutConstraint constraintsWithVisualFormat:@"H:[name]-[date]-20-|"
options:NSLayoutFormatAlignAllBaseline
metrics:metrics
views:views]];
[result addObjectsFromArray:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-(margin)-[image(imgSize)]"
options:0
metrics:metrics
views:views]];
[result addObjectsFromArray:[NSLayoutConstraint constraintsWithVisualFormat:@"V:[name]-[text]-20-|"
options:NSLayoutFormatAlignAllLeft
metrics:metrics
views:views]];
[result addObjectsFromArray:[NSLayoutConstraint constraintsWithVisualFormat:@"H:[text]-20-|"
options:NSLayoutFormatAlignAllBaseline
metrics:metrics
views:views]];
return result;
}
@end
@implementation PostTextLabel
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
// Initialization code
}
return self;
}
- (void) layoutSubviews {
[super layoutSubviews];
self.preferredMaxLayoutWidth = self.bounds.size.width;
}
@end

View File

@ -0,0 +1,34 @@
//
// XLJSONSerialization.h
// XLPagerTabStrip ( https://github.com/xmartlabs/XLPagerTabStrip )
//
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <Foundation/Foundation.h>
@interface XLJSONSerialization : NSObject
+ (instancetype)sharedInstance;
@property (readonly) NSArray * postsData;
@end

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

View File

@ -0,0 +1,30 @@
//
// SegmentedContainerViewController.h
// XLPagerTabStrip ( https://github.com/xmartlabs/XLPagerTabStrip )
//
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "XLSegmentedPagerTabStripViewController.h"
@interface SegmentedExampleViewController : XLSegmentedPagerTabStripViewController
@end

View File

@ -0,0 +1,59 @@
//
// SegmentedContainerViewController.m
// XLPagerTabStrip ( https://github.com/xmartlabs/XLPagerTabStrip )
//
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "MailBoxChildViewController.h"
#import "MailBoxTableChildViewController.h"
#import "SegmentedExampleViewController.h"
@interface SegmentedExampleViewController ()
@end
@implementation SegmentedExampleViewController
- (instancetype)initWithCoder:(NSCoder *)coder
{
self = [super initWithCoder:coder];
if (self) {
self.skipIntermediateViewControllers = NO;
}
return self;
}
#pragma mark - XLPagerTabStripViewControllerDataSource
-(NSArray *)childViewControllersForPagerTabStripViewController:(XLPagerTabStripViewController *)pagerTabStripViewController
{
// create child view controllers that will be managed by XLPagerTabStripViewController
MailBoxTableChildViewController * child_1 = [[MailBoxTableChildViewController alloc] initWithStyle:UITableViewStylePlain];
MailBoxChildViewController * child_2 = [[MailBoxChildViewController alloc] init];
MailBoxTableChildViewController * child_3 = [[MailBoxTableChildViewController alloc] initWithStyle:UITableViewStyleGrouped];
MailBoxChildViewController * child_4 = [[MailBoxChildViewController alloc] init];
return @[child_1, child_2, child_3, child_4];
}
@end

View File

@ -0,0 +1,317 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6254" systemVersion="14B25" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="ptL-BW-nEP">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6247"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
</dependencies>
<scenes>
<!--Segmented Example View Controller-->
<scene sceneID="xrm-yh-2gW">
<objects>
<viewController id="h8P-u9-NhP" customClass="SegmentedExampleViewController" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="lwA-FU-jT1"/>
<viewControllerLayoutGuide type="bottom" id="HdL-Q7-Anl"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="BPt-hn-p4R">
<rect key="frame" x="0.0" y="64" width="600" height="487"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="D5t-1q-KDh">
<rect key="frame" x="0.0" y="0.0" width="600" height="487"/>
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
</scrollView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="D5t-1q-KDh" firstAttribute="top" secondItem="lwA-FU-jT1" secondAttribute="bottom" id="57b-HV-bZv"/>
<constraint firstItem="D5t-1q-KDh" firstAttribute="leading" secondItem="BPt-hn-p4R" secondAttribute="leading" id="ROY-9D-t0I"/>
<constraint firstAttribute="trailing" secondItem="D5t-1q-KDh" secondAttribute="trailing" id="eaT-9S-B6g"/>
<constraint firstItem="HdL-Q7-Anl" firstAttribute="top" secondItem="D5t-1q-KDh" secondAttribute="bottom" id="mYL-zm-zb0"/>
</constraints>
</view>
<extendedEdge key="edgesForExtendedLayout" top="YES"/>
<navigationItem key="navigationItem" id="l1f-vB-6A8">
<nil key="title"/>
<segmentedControl key="titleView" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="top" segmentControlStyle="bar" selectedSegmentIndex="0" id="31B-gy-WIH">
<rect key="frame" x="8" y="7" width="304" height="30"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<segments>
<segment title="First"/>
<segment title="Second"/>
</segments>
<color key="tintColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
</segmentedControl>
</navigationItem>
<connections>
<outlet property="containerView" destination="D5t-1q-KDh" id="EwQ-Ub-iYS"/>
<outlet property="segmentedControl" destination="31B-gy-WIH" id="TxS-id-BP5"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="7KA-v4-CBs" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="2227.5" y="-583.09859154929575"/>
</scene>
<!--View Controller-->
<scene sceneID="sWd-rV-F4O">
<objects>
<viewController id="uba-Iz-2L2" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="Emc-3r-MJi"/>
<viewControllerLayoutGuide type="bottom" id="NbE-e0-l2n"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="Mqm-sG-Qyv">
<rect key="frame" x="0.0" y="0.0" width="600" height="551"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<containerView contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="qkQ-UG-MKG">
<rect key="frame" x="0.0" y="121" width="600" height="430"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<connections>
<segue destination="MOL-Zx-vbf" kind="embed" id="i47-4L-xIB"/>
</connections>
</containerView>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Storyboard Demo" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="cZN-qT-VUq">
<rect key="frame" x="207" y="52" width="187" height="27.5"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="23"/>
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" red="0.027450980390000001" green="0.72549019609999998" blue="0.60784313729999995" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="centerX" secondItem="cZN-qT-VUq" secondAttribute="centerX" id="AYy-gw-Ryh"/>
<constraint firstItem="NbE-e0-l2n" firstAttribute="top" secondItem="qkQ-UG-MKG" secondAttribute="bottom" id="K6Q-s5-nzV"/>
<constraint firstItem="cZN-qT-VUq" firstAttribute="top" secondItem="Emc-3r-MJi" secondAttribute="bottom" constant="32" id="RvZ-BV-1SL"/>
<constraint firstItem="qkQ-UG-MKG" firstAttribute="leading" secondItem="Mqm-sG-Qyv" secondAttribute="leading" id="Slo-zY-IGj"/>
<constraint firstItem="qkQ-UG-MKG" firstAttribute="top" secondItem="Emc-3r-MJi" secondAttribute="bottom" constant="101" id="nJw-ag-ddh"/>
<constraint firstAttribute="trailing" secondItem="qkQ-UG-MKG" secondAttribute="trailing" id="pTb-BC-Duc"/>
</constraints>
</view>
<tabBarItem key="tabBarItem" systemItem="contacts" id="1d9-i6-g9L"/>
<navigationItem key="navigationItem" id="ni8-Kh-JRq"/>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="jkN-pv-eFH" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1340.625" y="139.43661971830986"/>
</scene>
<!--Buttons Example-->
<scene sceneID="c3d-TB-Hyh">
<objects>
<viewController automaticallyAdjustsScrollViewInsets="NO" id="3jo-Zp-rsN" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="sYC-OQ-Mga"/>
<viewControllerLayoutGuide type="bottom" id="LUh-C3-i05"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="TXd-Bq-amB">
<rect key="frame" x="0.0" y="0.0" width="600" height="551"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<containerView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="9rp-Lg-ckk">
<rect key="frame" x="0.0" y="64" width="600" height="487"/>
<connections>
<segue destination="KF9-Il-rUn" kind="embed" id="PEH-Jc-gva"/>
</connections>
</containerView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="9rp-Lg-ckk" firstAttribute="top" secondItem="sYC-OQ-Mga" secondAttribute="bottom" id="Bkl-Sr-KoE"/>
<constraint firstItem="LUh-C3-i05" firstAttribute="top" secondItem="9rp-Lg-ckk" secondAttribute="bottom" id="Mel-a7-tS5"/>
<constraint firstAttribute="trailingMargin" secondItem="9rp-Lg-ckk" secondAttribute="trailing" constant="-16" id="UY1-sK-nWK"/>
<constraint firstItem="9rp-Lg-ckk" firstAttribute="leading" secondItem="TXd-Bq-amB" secondAttribute="leadingMargin" constant="-16" id="vBT-dV-v2T"/>
</constraints>
</view>
<navigationItem key="navigationItem" title="Buttons Example" id="anf-yu-jjb"/>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="79T-iZ-rpA" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="2225.625" y="917.95774647887322"/>
</scene>
<!--Bar Example View Controller-->
<scene sceneID="Ufs-nK-0Io">
<objects>
<viewController automaticallyAdjustsScrollViewInsets="NO" id="MOL-Zx-vbf" customClass="BarExampleViewController" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="hGu-f8-VlE"/>
<viewControllerLayoutGuide type="bottom" id="Twz-Ee-IJq"/>
</layoutGuides>
<view key="view" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="fnu-Fx-A6b">
<rect key="frame" x="0.0" y="0.0" width="600" height="430"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="srh-qY-UAa" customClass="XLBarView">
<rect key="frame" x="0.0" y="0.0" width="600" height="5"/>
<color key="backgroundColor" red="0.029917803763441025" green="0.92659837372448983" blue="0.78518703254703159" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="height" constant="5" id="EuL-ap-Nyh"/>
</constraints>
</view>
<scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" bounces="NO" alwaysBounceHorizontal="YES" pagingEnabled="YES" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" bouncesZoom="NO" translatesAutoresizingMaskIntoConstraints="NO" id="gaM-gk-dVJ">
<rect key="frame" x="0.0" y="5" width="600" height="425"/>
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
</scrollView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="trailing" secondItem="srh-qY-UAa" secondAttribute="trailing" id="NOC-hJ-B3n"/>
<constraint firstItem="gaM-gk-dVJ" firstAttribute="top" secondItem="srh-qY-UAa" secondAttribute="bottom" id="PWm-Hj-8ij"/>
<constraint firstItem="Twz-Ee-IJq" firstAttribute="top" secondItem="gaM-gk-dVJ" secondAttribute="bottom" id="XIC-x4-8zR"/>
<constraint firstItem="srh-qY-UAa" firstAttribute="top" secondItem="hGu-f8-VlE" secondAttribute="bottom" id="clp-Ty-ewx"/>
<constraint firstAttribute="trailing" secondItem="gaM-gk-dVJ" secondAttribute="trailing" id="d54-qR-N0V"/>
<constraint firstItem="gaM-gk-dVJ" firstAttribute="leading" secondItem="fnu-Fx-A6b" secondAttribute="leading" id="tbZ-mZ-r06"/>
<constraint firstItem="srh-qY-UAa" firstAttribute="leading" secondItem="fnu-Fx-A6b" secondAttribute="leading" id="wjd-Ul-s0i"/>
</constraints>
</view>
<toolbarItems/>
<connections>
<outlet property="barView" destination="srh-qY-UAa" id="A6r-8O-0MY"/>
<outlet property="containerView" destination="gaM-gk-dVJ" id="NqV-Sh-lY6"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="cKU-zQ-C4r" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="2227.5" y="139.43661971830986"/>
</scene>
<!--Tab Bar Controller-->
<scene sceneID="Lv9-yU-Knu">
<objects>
<tabBarController automaticallyAdjustsScrollViewInsets="NO" id="ptL-BW-nEP" sceneMemberID="viewController">
<toolbarItems/>
<nil key="simulatedBottomBarMetrics"/>
<tabBar key="tabBar" contentMode="scaleToFill" translucent="NO" id="Ki8-MR-faU">
<autoresizingMask key="autoresizingMask"/>
<color key="tintColor" red="0.027450980390000001" green="0.72549019609999998" blue="0.60784313729999995" alpha="1" colorSpace="calibratedRGB"/>
</tabBar>
<connections>
<segue destination="uba-Iz-2L2" kind="relationship" relationship="viewControllers" id="hNx-yW-oR3"/>
<segue destination="g7J-zS-0bu" kind="relationship" relationship="viewControllers" id="WG0-Of-C4e"/>
<segue destination="jWp-2W-r7X" kind="relationship" relationship="viewControllers" id="fRU-HE-nNs"/>
</connections>
</tabBarController>
<placeholder placeholderIdentifier="IBFirstResponder" id="YsA-SS-Qae" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="208.125" y="148.94366197183098"/>
</scene>
<!--Navigation Controller-->
<scene sceneID="gqT-2d-jBf">
<objects>
<navigationController id="g7J-zS-0bu" sceneMemberID="viewController">
<tabBarItem key="tabBarItem" systemItem="mostViewed" id="cv3-rF-uFc"/>
<toolbarItems/>
<navigationBar key="navigationBar" opaque="NO" contentMode="scaleToFill" translucent="NO" id="TRx-vY-PeE">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<color key="barTintColor" red="0.027450980390000001" green="0.72549019609999998" blue="0.60784313729999995" alpha="1" colorSpace="calibratedRGB"/>
</navigationBar>
<nil name="viewControllers"/>
<connections>
<segue destination="h8P-u9-NhP" kind="relationship" relationship="rootViewController" id="l8V-Zr-SH8"/>
</connections>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="lsc-9V-4Tm" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1327.5" y="-583.09859154929575"/>
</scene>
<!--Navigation Controller-->
<scene sceneID="aQc-cn-j2T">
<objects>
<navigationController automaticallyAdjustsScrollViewInsets="NO" id="jWp-2W-r7X" sceneMemberID="viewController">
<tabBarItem key="tabBarItem" systemItem="favorites" id="xNX-u1-4Tr"/>
<toolbarItems/>
<navigationBar key="navigationBar" contentMode="scaleToFill" id="2I8-g6-D4S">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<color key="barTintColor" red="0.027450980390000001" green="0.72549019609999998" blue="0.60784313729999995" alpha="1" colorSpace="calibratedRGB"/>
<textAttributes key="titleTextAttributes">
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</textAttributes>
</navigationBar>
<nil name="viewControllers"/>
<connections>
<segue destination="3jo-Zp-rsN" kind="relationship" relationship="rootViewController" id="Kvi-Ra-5dQ"/>
</connections>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="U4T-yC-y5O" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1340.625" y="917.95774647887322"/>
</scene>
<!--Button Bar Example View Controller-->
<scene sceneID="Ctn-j0-KV6">
<objects>
<viewController automaticallyAdjustsScrollViewInsets="NO" id="KF9-Il-rUn" customClass="ButtonBarExampleViewController" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="PhK-DQ-FzX"/>
<viewControllerLayoutGuide type="bottom" id="DoJ-0a-eFQ"/>
</layoutGuides>
<view key="view" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="nbo-eG-9Of">
<rect key="frame" x="0.0" y="0.0" width="600" height="487"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" dataMode="prototypes" translatesAutoresizingMaskIntoConstraints="NO" id="FH0-FX-IMd" customClass="XLButtonBarView">
<rect key="frame" x="0.0" y="0.0" width="600" height="43"/>
<color key="backgroundColor" red="0.027450980390000001" green="0.72549019609999998" blue="0.60784313729999995" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="height" constant="43" id="5Gm-jk-c1U"/>
</constraints>
<collectionViewFlowLayout key="collectionViewLayout" scrollDirection="horizontal" minimumLineSpacing="10" minimumInteritemSpacing="10" id="q1I-j6-uGl">
<size key="itemSize" width="79" height="42"/>
<size key="headerReferenceSize" width="0.0" height="0.0"/>
<size key="footerReferenceSize" width="0.0" height="0.0"/>
<inset key="sectionInset" minX="35" minY="0.0" maxX="35" maxY="0.0"/>
</collectionViewFlowLayout>
<cells>
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="Cell" id="aWZ-BZ-wgL" customClass="XLButtonBarViewCell">
<rect key="frame" x="0.0" y="1" width="79" height="42"/>
<autoresizingMask key="autoresizingMask"/>
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
<rect key="frame" x="0.0" y="0.0" width="79" height="42"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Idp-Ip-IhM">
<rect key="frame" x="17" y="10" width="44" height="21"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="17"/>
<color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
</view>
<constraints>
<constraint firstAttribute="centerX" secondItem="Idp-Ip-IhM" secondAttribute="centerX" constant="0.5" id="pih-0U-0bL"/>
<constraint firstAttribute="centerY" secondItem="Idp-Ip-IhM" secondAttribute="centerY" constant="0.5" id="zfA-qf-esp"/>
</constraints>
<connections>
<outlet property="label" destination="Idp-Ip-IhM" id="mtZ-b6-rE0"/>
</connections>
</collectionViewCell>
</cells>
</collectionView>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="mcV-6K-P6b" customClass="UIScrollView">
<rect key="frame" x="-5" y="43" width="610" height="444"/>
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
</view>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="FH0-FX-IMd" firstAttribute="leading" secondItem="nbo-eG-9Of" secondAttribute="leadingMargin" constant="-16" id="9Vk-yi-Pua"/>
<constraint firstAttribute="trailing" secondItem="mcV-6K-P6b" secondAttribute="trailing" constant="-5" id="Ext-Th-Ehh"/>
<constraint firstItem="mcV-6K-P6b" firstAttribute="leading" secondItem="nbo-eG-9Of" secondAttribute="leading" constant="-5" id="MLz-uv-OaE"/>
<constraint firstItem="DoJ-0a-eFQ" firstAttribute="top" secondItem="mcV-6K-P6b" secondAttribute="bottom" id="nPm-AC-pyc"/>
<constraint firstItem="FH0-FX-IMd" firstAttribute="top" secondItem="PhK-DQ-FzX" secondAttribute="bottom" id="s00-0U-AXh"/>
<constraint firstItem="mcV-6K-P6b" firstAttribute="top" secondItem="FH0-FX-IMd" secondAttribute="bottom" id="stn-uq-Zft"/>
<constraint firstAttribute="trailingMargin" secondItem="FH0-FX-IMd" secondAttribute="trailing" constant="-16" id="z4H-9f-Vyy"/>
</constraints>
</view>
<toolbarItems/>
<connections>
<outlet property="buttonBarView" destination="FH0-FX-IMd" id="HvT-oB-FoW"/>
<outlet property="containerView" destination="mcV-6K-P6b" id="feg-Vf-NRY"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="ls9-Xb-7by" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="3035.625" y="917.42957746478862"/>
</scene>
</scenes>
</document>

View File

@ -0,0 +1,31 @@
{
"images" : [
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "xl_appicon_58.png",
"scale" : "2x"
},
{
"size" : "40x40",
"idiom" : "iphone",
"filename" : "xl_appicon_80.png",
"scale" : "2x"
},
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "xl_appicon_120.png",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x",
"filename" : "xl_splash@2x.png"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

View File

@ -0,0 +1,24 @@
{
"images" : [
{
"orientation" : "portrait",
"idiom" : "iphone",
"extent" : "full-screen",
"minimum-system-version" : "7.0",
"scale" : "2x"
},
{
"extent" : "full-screen",
"idiom" : "iphone",
"subtype" : "retina4",
"filename" : "xl_splash@2x.png",
"minimum-system-version" : "7.0",
"orientation" : "portrait",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

View File

@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "Apu_Nahasapeemapetilon.png"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

View File

@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "Bart_Simpsons.png"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

View File

@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "Homer_Simpsons.png"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

View File

@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "Lisa_Simpsons.png"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View File

@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "Maggie_Simpsons.png"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "Marge_Simpsons.png"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

View File

@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "Montgomery_Burns.png"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View File

@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "Ned_Flanders.png"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "Otto_Mann.png"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View File

@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x",
"filename" : "default-avatar@2x.png"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

View File

@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "Posts_Selected.png"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "Posts_Unselected.png"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "Users_Selected.png"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "Users_Unselected.png"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>UILaunchImageFile</key>
<string>LaunchImage</string>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>com.xmartlabs.$(PRODUCT_NAME:rfc1034identifier)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIMainStoryboardFile</key>
<string>Storyboard</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>

View File

@ -0,0 +1,33 @@
//
// XLBarPagerTabStripViewController.h
// XLPagerTabStrip ( https://github.com/xmartlabs/XLPagerTabStrip )
//
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "XLBarView.h"
#import "XLPagerTabStripViewController.h"
@interface XLBarPagerTabStripViewController : XLPagerTabStripViewController
@property (nonatomic) IBOutlet XLBarView * barView;
@end

View File

@ -0,0 +1,82 @@
//
// XLBarPagerTabStripViewController.m
// XLPagerTabStrip ( https://github.com/xmartlabs/XLPagerTabStrip )
//
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "XLBarPagerTabStripViewController.h"
@interface XLBarPagerTabStripViewController ()
@end
@implementation XLBarPagerTabStripViewController
- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
}
return self;
}
- (instancetype)initWithCoder:(NSCoder *)coder
{
self = [super initWithCoder:coder];
if (self) {
}
return self;
}
-(void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
if (!self.barView.superview){
[self.view addSubview:self.barView];
}
else{
[self.barView setOptionsAmount:[self.dataSource childViewControllersForPagerTabStripViewController:self].count animated:NO];
[self.barView moveToIndex:self.currentIndex animated:NO];
}
}
-(XLBarView *)barView
{
if (_barView) return _barView;
_barView = [[XLBarView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 5.0f) optionsAmount:[self.dataSource childViewControllersForPagerTabStripViewController:self].count selectedOptionIndex:self.currentIndex];
_barView.backgroundColor = [UIColor orangeColor];
_barView.selectedBar.backgroundColor = [UIColor blackColor];
_barView.autoresizingMask = UIViewAutoresizingFlexibleWidth;
return _barView;
}
#pragma mark - XLPagerTabStripViewControllerDelegate
-(void)pagerTabStripViewController:(XLPagerTabStripViewController *)pagerTabStripViewController updateIndicatorToViewController:(UIViewController *)toViewController fromViewController:(UIViewController *)fromViewController
{
[self.barView moveToIndex:[self.pagerTabStripChildViewControllers indexOfObject:toViewController] animated:YES];
}
@end

View File

@ -0,0 +1,33 @@
//
// XLButtonBarPagerTabStripViewController.h
// XLPagerTabStrip ( https://github.com/xmartlabs/XLPagerTabStrip )
//
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "XLButtonBarView.h"
#import "XLPagerTabStripViewController.h"
@interface XLButtonBarPagerTabStripViewController : XLPagerTabStripViewController
@property (readonly, nonatomic) XLButtonBarView * buttonBarView;
@end

View File

@ -0,0 +1,176 @@
//
// XLButtonBarPagerTabStripViewController.m
// XLPagerTabStrip ( https://github.com/xmartlabs/XLPagerTabStrip )
//
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "XLButtonBarViewCell.h"
#import "XLButtonBarPagerTabStripViewController.h"
@interface XLButtonBarPagerTabStripViewController () <UICollectionViewDelegate, UICollectionViewDataSource>
@property (nonatomic) IBOutlet XLButtonBarView * buttonBarView;
@property (nonatomic) BOOL shouldUpdateButtonBarView;
@end
@implementation XLButtonBarPagerTabStripViewController
{
XLButtonBarViewCell * _sizeCell;
}
- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
self.shouldUpdateButtonBarView = YES;
}
return self;
}
- (instancetype)initWithCoder:(NSCoder *)coder
{
self = [super initWithCoder:coder];
if (self) {
self.shouldUpdateButtonBarView = YES;
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
if (!self.buttonBarView.superview){
[self.view addSubview:self.buttonBarView];
}
if (!self.buttonBarView.delegate){
self.buttonBarView.delegate = self;
}
if (!self.buttonBarView.dataSource){
self.buttonBarView.dataSource = self;
}
self.buttonBarView.labelFont = [UIFont fontWithName:@"Helvetica-Bold" size:18.0f];
self.buttonBarView.leftRightMargin = 8;
UICollectionViewFlowLayout * flowLayout = (id)self.buttonBarView.collectionViewLayout;
[flowLayout setScrollDirection:UICollectionViewScrollDirectionHorizontal];
[self.buttonBarView setShowsHorizontalScrollIndicator:NO];
}
-(void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
UICollectionViewLayoutAttributes *attributes = [self.buttonBarView layoutAttributesForItemAtIndexPath:[NSIndexPath indexPathForItem:self.currentIndex inSection:0]];
CGRect cellRect = attributes.frame;
[self.buttonBarView.selectedBar setFrame:CGRectMake(cellRect.origin.x, self.buttonBarView.frame.size.height - 5, cellRect.size.width, 5)];
}
-(XLButtonBarView *)buttonBarView
{
if (_buttonBarView) return _buttonBarView;
UICollectionViewFlowLayout * flowLayout = [[UICollectionViewFlowLayout alloc] init];
[flowLayout setScrollDirection:UICollectionViewScrollDirectionHorizontal];
[flowLayout setSectionInset:UIEdgeInsetsMake(0, 35, 0, 35)];
_buttonBarView = [[XLButtonBarView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 50.0f) collectionViewLayout:flowLayout];
_buttonBarView.backgroundColor = [UIColor orangeColor];
_buttonBarView.selectedBar.backgroundColor = [UIColor blackColor];
_buttonBarView.autoresizingMask = UIViewAutoresizingFlexibleWidth;
return _buttonBarView;
}
#pragma mark - XLPagerTabStripViewControllerDelegate
-(void)pagerTabStripViewController:(XLPagerTabStripViewController *)pagerTabStripViewController updateIndicatorToViewController:(UIViewController *)toViewController fromViewController:(UIViewController *)fromViewController
{
if (self.shouldUpdateButtonBarView){
NSUInteger newIndex = [self.pagerTabStripChildViewControllers indexOfObject:toViewController];
XLPagerTabStripDirection direction = XLPagerTabStripDirectionLeft;
if (newIndex < [self.pagerTabStripChildViewControllers indexOfObject:fromViewController]){
direction = XLPagerTabStripDirectionRight;
}
[self.buttonBarView moveToIndex:newIndex animated:YES swipeDirection:direction];
}
}
#pragma merk - UICollectionViewDelegateFlowLayout
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath
{
UILabel * label = [[UILabel alloc] init];
[label setTranslatesAutoresizingMaskIntoConstraints:NO];
label.font = self.buttonBarView.labelFont;
UIViewController<XLPagerTabStripChildItem> * childController = [self.pagerTabStripChildViewControllers objectAtIndex:indexPath.item];
[label setText:[childController titleForPagerTabStripViewController:self]];
CGSize labelSize = [label intrinsicContentSize];
return CGSizeMake(labelSize.width + (self.buttonBarView.leftRightMargin * 2), collectionView.frame.size.height);
}
#pragma mark - UICollectionViewDelegate
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
{
[self.buttonBarView moveToIndex:indexPath.item animated:YES swipeDirection:XLPagerTabStripDirectionNone];
self.shouldUpdateButtonBarView = NO;
[self moveToViewControllerAtIndex:indexPath.item];
}
#pragma merk - UICollectionViewDataSource
-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
return self.pagerTabStripChildViewControllers.count;
}
// The cell that is returned must be retrieved from a call to -dequeueReusableCellWithReuseIdentifier:forIndexPath:
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
UICollectionViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"Cell" forIndexPath:indexPath];
if (!cell){
cell = [[XLButtonBarViewCell alloc] initWithFrame:CGRectMake(0, 0, 50, self.buttonBarView.frame.size.height)];
}
NSAssert([cell isKindOfClass:[XLButtonBarViewCell class]], @"UICollectionViewCell should be or extend XLButtonBarViewCell");
XLButtonBarViewCell * buttonBarCell = (XLButtonBarViewCell *)cell;
UIViewController<XLPagerTabStripChildItem> * childController = [self.pagerTabStripChildViewControllers objectAtIndex:indexPath.item];
[buttonBarCell.label setText:[childController titleForPagerTabStripViewController:self]];
return buttonBarCell;
}
#pragma mark - UIScrollViewDelegate
-(void)scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView
{
[super scrollViewDidEndScrollingAnimation:scrollView];
if (scrollView == self.containerView){
self.shouldUpdateButtonBarView = YES;
}
}
@end

View File

@ -0,0 +1,89 @@
//
// XLPagerTabStripViewController.h
// XLPagerTabStrip ( https://github.com/xmartlabs/XLPagerTabStrip )
//
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <UIKit/UITableViewController.h>
#import <UIKit/UIKit.h>
@class XLPagerTabStripViewController;
/**
The `XLPagerTabStripChildItem` protocol is adopted by child controllers of XLPagerTabStripViewController. 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.
*/
@protocol XLPagerTabStripChildItem <NSObject>
@required
- (NSString *)titleForPagerTabStripViewController:(XLPagerTabStripViewController *)pagerTabStripViewController;
@optional
- (UIImage *)imageForPagerTabStripViewController:(XLPagerTabStripViewController *)pagerTabStripViewController;
- (UIColor *)colorForPagerTabStripViewController:(XLPagerTabStripViewController *)pagerTabStripViewController;
@end
typedef NS_ENUM(NSUInteger, XLPagerTabStripDirection) {
XLPagerTabStripDirectionLeft,
XLPagerTabStripDirectionRight,
XLPagerTabStripDirectionNone
};
@protocol XLPagerTabStripViewControllerDelegate <NSObject>
@optional
-(void)pagerTabStripViewController:(XLPagerTabStripViewController *)pagerTabStripViewController updateIndicatorToViewController:(UIViewController *)toViewController fromViewController:(UIViewController *)fromViewController;
@end
@protocol XLPagerTabStripViewControllerDataSource <NSObject>
@required
-(NSArray *)childViewControllersForPagerTabStripViewController:(XLPagerTabStripViewController *)pagerTabStripViewController;
@end
@interface XLPagerTabStripViewController : UIViewController <XLPagerTabStripViewControllerDelegate, XLPagerTabStripViewControllerDataSource, UIScrollViewDelegate>
@property (readonly) NSArray * pagerTabStripChildViewControllers;
@property (nonatomic, retain) IBOutlet UIScrollView * containerView;
@property (nonatomic, assign) IBOutlet id<XLPagerTabStripViewControllerDelegate> delegate;
@property (nonatomic, assign) IBOutlet id<XLPagerTabStripViewControllerDataSource> dataSource;
@property (readonly) NSUInteger currentIndex;
@property BOOL skipIntermediateViewControllers;
-(void)moveToViewControllerAtIndex:(NSUInteger)index;
-(void)moveToViewController:(UIViewController *)viewController;
@end

View File

@ -0,0 +1,339 @@
//
// XLPagerTabStripViewController
// XLPagerTabStrip ( https://github.com/xmartlabs/XLPagerTabStrip )
//
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "XLPagerTabStripViewController.h"
@interface XLPagerTabStripViewController ()
@property (nonatomic) NSUInteger currentIndex;
@end
@implementation XLPagerTabStripViewController
{
NSUInteger _lastPageNumber;
CGFloat _lastContentOffset;
NSUInteger _pageBeforeRotate;
NSArray * _originalPagerTabStripChildViewControllers;
}
@synthesize currentIndex = _currentIndex;
#pragma maek - initializers
-(id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self){
[self pagerTabStripViewControllerInit];
}
return self;
}
-(id)initWithCoder:(NSCoder *)aDecoder
{
self = [super initWithCoder:aDecoder];
if (self)
{
[self pagerTabStripViewControllerInit];
}
return self;
}
-(void)pagerTabStripViewControllerInit
{
_currentIndex = 0;
_delegate = self;
_dataSource = self;
_lastContentOffset = 0.0f;
_skipIntermediateViewControllers = YES;
}
- (void)viewDidLoad
{
[super viewDidLoad];
if (!self.containerView){
self.containerView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth(self.view.bounds), CGRectGetHeight(self.view.bounds))];
self.containerView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
[self.view addSubview:self.containerView];
}
self.containerView.bounces = YES;
[self.containerView setAlwaysBounceHorizontal:YES];
[self.containerView setAlwaysBounceVertical:NO];
self.containerView.scrollsToTop = NO;
self.containerView.delegate = self;
self.containerView.showsVerticalScrollIndicator = NO;
self.containerView.showsHorizontalScrollIndicator = NO;
self.containerView.pagingEnabled = YES;
if (self.dataSource){
_pagerTabStripChildViewControllers = [self.dataSource childViewControllersForPagerTabStripViewController:self];
}
}
-(void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
[self.containerView setContentOffset:CGPointMake([self pageOffsetForChildIndex:self.currentIndex], 0) animated:NO];
}
#pragma mark - move to another view controller
-(void)moveToViewControllerAtIndex:(NSUInteger)index
{
[self moveToViewControllerAtIndex:index animated:YES];
}
-(void)moveToViewControllerAtIndex:(NSInteger)index withDirection:(XLPagerTabStripDirection)direction animated:(BOOL)animated
{
if (self.skipIntermediateViewControllers && fabs(self.currentIndex - index) > 1){
NSArray * originalPagerTabStripChildViewControllers = self.pagerTabStripChildViewControllers;
NSMutableArray * tempChildViewControllers = [NSMutableArray arrayWithArray:originalPagerTabStripChildViewControllers];
UIViewController * currentChildVC = [originalPagerTabStripChildViewControllers objectAtIndex:self.currentIndex];
NSUInteger fromIndex = (direction == XLPagerTabStripDirectionLeft) ? index - 1 : index + 1;
[tempChildViewControllers setObject:[originalPagerTabStripChildViewControllers objectAtIndex:fromIndex] atIndexedSubscript:self.currentIndex];
[tempChildViewControllers setObject:currentChildVC atIndexedSubscript:fromIndex];
_pagerTabStripChildViewControllers = tempChildViewControllers;
[self.containerView setContentOffset:CGPointMake([self pageOffsetForChildIndex:fromIndex], 0) animated:NO];
if (self.navigationController){
self.navigationController.view.userInteractionEnabled = NO;
}
else{
self.view.userInteractionEnabled = NO;
}
_originalPagerTabStripChildViewControllers = originalPagerTabStripChildViewControllers;
[self.containerView setContentOffset:CGPointMake([self pageOffsetForChildIndex:index], 0) animated:YES];
}
else{
[self.containerView setContentOffset:CGPointMake([self pageOffsetForChildIndex:index], 0) animated:animated];
}
}
-(void)moveToViewControllerAtIndex:(NSUInteger)index animated:(bool)animated
{
if (![self isViewLoaded]){
self.currentIndex = index;
}
else{
if (self.currentIndex < index){
[self moveToViewControllerAtIndex:index withDirection:XLPagerTabStripDirectionLeft animated:YES];
}
else if (self.currentIndex > index){
[self moveToViewControllerAtIndex:index withDirection:XLPagerTabStripDirectionRight animated:YES];
}
}
}
-(void)moveToViewController:(UIViewController *)viewController
{
[self moveToViewControllerAtIndex:[self.pagerTabStripChildViewControllers indexOfObject:viewController]];
}
#pragma mark - XLPagerTabStripViewControllerDelegate
-(void)pagerTabStripViewController:(XLPagerTabStripViewController *)pagerTabStripViewController updateIndicatorToViewController:(UIViewController *)toViewController fromViewController:(UIViewController *)fromViewController{
}
#pragma mark - XLPagerTabStripViewControllerDataSource
-(NSArray *)childViewControllersForPagerTabStripViewController:(XLPagerTabStripViewController *)pagerTabStripViewController
{
return self.pagerTabStripChildViewControllers;
}
#pragma mark - Helpers
-(BOOL)canMoveToIndex:(NSUInteger)index
{
return (self.currentIndex != index && self.pagerTabStripChildViewControllers.count > index);
}
-(CGFloat)pageOffsetForChildIndex:(NSUInteger)index
{
return (index * CGRectGetWidth(self.containerView.bounds));
}
-(CGFloat)offsetForChildIndex:(NSUInteger)index
{
return (index * CGRectGetWidth(self.containerView.bounds) + ((CGRectGetWidth(self.containerView.bounds) - CGRectGetWidth(self.view.bounds)) * 0.5));
}
-(CGFloat)offsetForChildViewController:(UIViewController *)viewController
{
NSInteger index = [self.pagerTabStripChildViewControllers indexOfObject:viewController];
if (index == NSNotFound){
@throw [NSException exceptionWithName:NSRangeException reason:nil userInfo:nil];
}
return [self offsetForChildIndex:index];
}
-(NSUInteger)pageForContentOffset:(CGFloat)contentOffset
{
return (contentOffset + (0.5f * [self pageWidth])) / [self pageWidth];
}
-(CGFloat)pageWidth
{
return CGRectGetWidth(self.containerView.bounds);
}
-(CGFloat)scrollPercentage
{
return fmodf(self.containerView.contentOffset.x, [self pageWidth]) / [self pageWidth];
}
-(void)updateContent
{
NSArray * childViewControllers = self.pagerTabStripChildViewControllers;
self.containerView.contentSize = CGSizeMake(CGRectGetWidth(self.containerView.bounds) * childViewControllers.count, self.containerView.contentSize.height);
NSUInteger currentPage = [self pageForContentOffset:self.containerView.contentOffset.x];
if (currentPage != self.currentIndex){
self.currentIndex = currentPage;
}
[childViewControllers enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
UIViewController * childController = (UIViewController *)obj;
CGFloat pageOffsetForChild = [self pageOffsetForChildIndex:idx];
if (fabs(self.containerView.contentOffset.x - pageOffsetForChild) < CGRectGetWidth(self.containerView.bounds)){
if (![childController parentViewController]){
[self addChildViewController:childController];
[childController didMoveToParentViewController:self];
CGFloat childPosition = [self offsetForChildIndex:idx];
[childController.view setFrame:CGRectMake(childPosition, 0, CGRectGetWidth(self.view.bounds), CGRectGetHeight(self.containerView.bounds))];
childController.view.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
[self.containerView addSubview:childController.view];
}
else{
CGFloat childPosition = [self offsetForChildIndex:idx];
[childController.view setFrame:CGRectMake(childPosition, 0, CGRectGetWidth(self.view.bounds), CGRectGetHeight(self.containerView.bounds))];
childController.view.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
}
}
else{
if ([childController parentViewController]){
[childController.view removeFromSuperview];
[childController willMoveToParentViewController:nil];
[childController removeFromParentViewController];
}
}
}];
}
#pragma mark - UIScrollViewDelegte
-(void)scrollViewDidScroll:(UIScrollView *)scrollView
{
if (self.containerView == scrollView){
// pan direction
XLPagerTabStripDirection direction = XLPagerTabStripDirectionNone;
if (scrollView.contentOffset.x > _lastContentOffset){
direction = XLPagerTabStripDirectionLeft;
}
else if (scrollView.contentOffset.x < _lastContentOffset){
direction = XLPagerTabStripDirectionRight;
}
[self updateContent];
}
}
-(void)scrollViewWillBeginDragging:(UIScrollView *)scrollView
{
if (self.containerView == scrollView){
_lastPageNumber = [self pageForContentOffset:scrollView.contentOffset.x];
_lastContentOffset = scrollView.contentOffset.x;
}
}
-(void)scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView
{
if (self.containerView == scrollView && _originalPagerTabStripChildViewControllers){
_pagerTabStripChildViewControllers = _originalPagerTabStripChildViewControllers;
_originalPagerTabStripChildViewControllers = nil;
if (self.navigationController){
self.navigationController.view.userInteractionEnabled = YES;
}
else{
self.view.userInteractionEnabled = YES;
}
[self updateContent];
}
}
#pragma mark - Properties
-(NSUInteger)currentIndex
{
return _currentIndex;
}
-(void)setCurrentIndex:(NSUInteger)currentIndex
{
UIViewController * fromViewController = [self.pagerTabStripChildViewControllers objectAtIndex:_currentIndex];
_currentIndex = currentIndex;
// invoke delegate method
if ([self.delegate respondsToSelector:@selector(pagerTabStripViewController:updateIndicatorToViewController:fromViewController:)]){
[self.delegate pagerTabStripViewController:self updateIndicatorToViewController:[self.pagerTabStripChildViewControllers objectAtIndex:_currentIndex] fromViewController:fromViewController];
}
//
}
#pragma mark - Orientation
-(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
_pageBeforeRotate = self.currentIndex;
}
-(void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
self.currentIndex = _pageBeforeRotate;
self.containerView.contentSize = CGSizeMake(CGRectGetWidth(self.containerView.bounds) * self.pagerTabStripChildViewControllers.count, self.containerView.contentSize.height);
[self.containerView setContentOffset:CGPointMake([self pageOffsetForChildIndex:_pageBeforeRotate], 0) animated:NO];
[self updateContent];
}
-(void)viewDidLayoutSubviews
{
//NSLog(@"%s", __PRETTY_FUNCTION__);
[super viewDidLayoutSubviews];
[self updateContent];
}
@end

View File

@ -0,0 +1,32 @@
//
// XLSegmentedPagerTabStripViewController.h
// XLPagerTabStrip ( https://github.com/xmartlabs/XLPagerTabStrip )
//
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "XLPagerTabStripViewController.h"
@interface XLSegmentedPagerTabStripViewController : XLPagerTabStripViewController
@property (nonatomic, readonly) UISegmentedControl * segmentedControl;
@end

View File

@ -0,0 +1,123 @@
//
// XLSegmentedPagerTabStripViewController.m
// XLPagerTabStrip ( https://github.com/xmartlabs/XLPagerTabStrip )
//
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "XLPagerTabStripViewController.h"
#import "XLSegmentedPagerTabStripViewController.h"
@interface XLSegmentedPagerTabStripViewController ()
@property (nonatomic) IBOutlet UISegmentedControl * segmentedControl;
@property (nonatomic) BOOL shouldUpdateSegmentedControl;
@end
@implementation XLSegmentedPagerTabStripViewController
-(id)initWithCoder:(NSCoder *)aDecoder
{
self = [super initWithCoder:aDecoder];
if (self){
self.shouldUpdateSegmentedControl = YES;
}
return self;
}
-(instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self){
self.shouldUpdateSegmentedControl = YES;
}
return self;
}
-(void)viewDidLoad
{
[super viewDidLoad];
// initialize segmented control
if (!self.segmentedControl.superview) {
[self.navigationItem setTitleView:self.segmentedControl];
}
[self.segmentedControl removeAllSegments];
[self.segmentedControl addTarget:self
action:@selector(segmentedControlChanged:)
forControlEvents:UIControlEventValueChanged];
[self.pagerTabStripChildViewControllers enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
NSAssert([obj conformsToProtocol:@protocol(XLPagerTabStripChildItem)], @"child view controller must conform to XLPagerTabStripChildItem");
UIViewController<XLPagerTabStripChildItem> * childViewController = (UIViewController<XLPagerTabStripChildItem> *)obj;
if ([childViewController respondsToSelector:@selector(imageForPagerTabStripViewController:)]){
[self.segmentedControl insertSegmentWithImage:[childViewController imageForPagerTabStripViewController:self] atIndex:idx animated:NO];
}
else{
[self.segmentedControl insertSegmentWithTitle:[childViewController titleForPagerTabStripViewController:self] atIndex:idx animated:NO];
}
}];
[self.segmentedControl setSelectedSegmentIndex:self.currentIndex];
}
-(UISegmentedControl *)segmentedControl
{
if (_segmentedControl) return _segmentedControl;
_segmentedControl = [[UISegmentedControl alloc] init];
return _segmentedControl;
}
-(void)segmentedControlChanged:(UISegmentedControl *)sender
{
NSInteger index = [sender selectedSegmentIndex];
[self pagerTabStripViewController:self updateIndicatorToViewController:[[self.dataSource childViewControllersForPagerTabStripViewController:self] objectAtIndex:index] fromViewController:nil];
self.shouldUpdateSegmentedControl = NO;
[self moveToViewControllerAtIndex:index];
}
#pragma mark - XLPagerTabStripViewControllerDelegate
-(void)pagerTabStripViewController:(XLPagerTabStripViewController *)pagerTabStripViewController updateIndicatorToViewController:(UIViewController *)toViewController fromViewController:(UIViewController *)fromViewController
{
if (self.shouldUpdateSegmentedControl){
UIViewController<XLPagerTabStripChildItem> * childViewController = (UIViewController<XLPagerTabStripChildItem> *)toViewController;
if ([childViewController respondsToSelector:@selector(colorForPagerTabStripViewController:)]){
[self.segmentedControl setTintColor:[childViewController colorForPagerTabStripViewController:self]];
}
[self.segmentedControl setSelectedSegmentIndex:[self.pagerTabStripChildViewControllers indexOfObject:childViewController]];
}
}
#pragma mark - UIScrollViewDelegate
-(void)scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView
{
[super scrollViewDidEndScrollingAnimation:scrollView];
self.shouldUpdateSegmentedControl = YES;
}
@end

View File

@ -0,0 +1,37 @@
//
// XLBarView.h
// XLPagerTabStrip ( https://github.com/xmartlabs/XLPagerTabStrip )
//
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <UIKit/UIKit.h>
@interface XLBarView : UIView
@property (readonly, nonatomic) UIView * selectedBar;
-(id)initWithFrame:(CGRect)frame optionsAmount:(NSUInteger)optionsAmount selectedOptionIndex:(NSUInteger)selectedOptionIndex;
-(void)moveToIndex:(NSUInteger)index animated:(BOOL)animated;
-(void)setOptionsAmount:(NSUInteger)optionsAmount animated:(BOOL)animated;
@end

View File

@ -0,0 +1,118 @@
//
// XLBarView.m
// XLPagerTabStrip ( https://github.com/xmartlabs/XLPagerTabStrip )
//
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "XLBarView.h"
@interface XLBarView()
@property UIView * selectedBar;
@property NSUInteger optionsAmount;
@property NSUInteger selectedOptionIndex;
@end
@implementation XLBarView
- (instancetype)initWithCoder:(NSCoder *)coder
{
self = [super initWithCoder:coder];
if (self) {
_optionsAmount = 1;
_selectedOptionIndex = 0;
[self addSubview:self.selectedBar];
}
return self;
}
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
// Initialization code
_optionsAmount = 1;
_selectedOptionIndex = 0;
}
return self;
}
- (id)initWithFrame:(CGRect)frame optionsAmount:(NSUInteger)optionsAmount selectedOptionIndex:(NSUInteger)selectedOptionIndex
{
self = [self initWithFrame:frame];
if (self){
_optionsAmount = optionsAmount;
_selectedOptionIndex = selectedOptionIndex;
[self addSubview:self.selectedBar];
}
return self;
}
-(UIView *)selectedBar
{
if (_selectedBar) return _selectedBar;
_selectedBar = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
[self updateSelectedBarPositionWithAnimation:NO];
return _selectedBar;
}
#pragma mark - Helpers
-(void)updateSelectedBarPositionWithAnimation:(BOOL)animation
{
CGRect frame = self.selectedBar.frame;
frame.size.width = self.frame.size.width / self.optionsAmount;
frame.origin.x = frame.size.width * self.selectedOptionIndex;
if (animation){
[UIView animateWithDuration:0.3 animations:^{
[self.selectedBar setFrame:frame];
}];
}
else{
self.selectedBar.frame = frame;
}
}
-(void)moveToIndex:(NSUInteger)index animated:(BOOL)animated
{
self.selectedOptionIndex = index;
[self updateSelectedBarPositionWithAnimation:animated];
}
-(void)setOptionsAmount:(NSUInteger)optionsAmount animated:(BOOL)animated
{
self.optionsAmount = optionsAmount;
if (self.optionsAmount <= self.selectedOptionIndex){
self.selectedOptionIndex = self.optionsAmount - 1;
}
[self updateSelectedBarPositionWithAnimation:animated];
}
-(void)layoutSubviews
{
[self updateSelectedBarPositionWithAnimation:NO];
}
@end

View File

@ -0,0 +1,42 @@
//
// XLButtonBarView.h
// XLPagerTabStrip ( https://github.com/xmartlabs/XLPagerTabStrip )
//
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <UIKit/UIKit.h>
#import "XLPagerTabStripViewController.h"
@interface XLButtonBarView : UICollectionView
@property (readonly, nonatomic) UIView * selectedBar;
@property UIFont * labelFont;
@property NSUInteger leftRightMargin;
-(void)moveToIndex:(NSUInteger)index animated:(BOOL)animated swipeDirection:(XLPagerTabStripDirection)swipeDirection;
@end

View File

@ -0,0 +1,118 @@
//
// XLButtonBarView.m
// XLPagerTabStrip ( https://github.com/xmartlabs/XLPagerTabStrip )
//
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "XLButtonBarView.h"
@interface XLButtonBarView ()
@property UIView * selectedBar;
@property NSUInteger selectedOptionIndex;
@end
@implementation XLButtonBarView
- (instancetype)initWithCoder:(NSCoder *)coder
{
self = [super initWithCoder:coder];
if (self) {
[self initializeXLButtonBarView];
}
return self;
}
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self initializeXLButtonBarView];
}
return self;
}
-(void)initializeXLButtonBarView
{
_selectedOptionIndex = 0;
[self addSubview:self.selectedBar];
}
-(void)moveToIndex:(NSUInteger)index animated:(BOOL)animated swipeDirection:(XLPagerTabStripDirection)swipeDirection
{
if (self.selectedOptionIndex != index){
self.selectedOptionIndex = index;
[self updateSelectedBarPositionWithAnimation:animated swipeDirection:swipeDirection];
}
}
-(void)updateSelectedBarPositionWithAnimation:(BOOL)animation swipeDirection:(XLPagerTabStripDirection)swipeDirection
{
CGRect frame = self.selectedBar.frame;
UICollectionViewCell * cell = [self.dataSource collectionView:self cellForItemAtIndexPath:[NSIndexPath indexPathForItem:self.selectedOptionIndex inSection:0]];
if (cell){
if (swipeDirection != XLPagerTabStripDirectionNone){
if (swipeDirection == XLPagerTabStripDirectionLeft)
{
float xValue = MIN(self.contentSize.width - self.frame.size.width, cell.frame.origin.x <= 35 ? 0 : cell.frame.origin.x - 35);
[self setContentOffset:CGPointMake(xValue, 0) animated:animation];
}
else if (swipeDirection == XLPagerTabStripDirectionRight){
float xValue = MAX(0, cell.frame.origin.x + cell.frame.size.width - self.frame.size.width + 35);
[self setContentOffset:CGPointMake(xValue, 0) animated:animation];
}
}
}
frame.size.width = cell.frame.size.width;
frame.origin.x = cell.frame.origin.x;
frame.origin.y = cell.frame.size.height - frame.size.height;
if (animation){
[UIView animateWithDuration:0.3 animations:^{
[self.selectedBar setFrame:frame];
}];
}
else{
self.selectedBar.frame = frame;
}
}
#pragma mark - Properties
-(UIView *)selectedBar
{
if (_selectedBar) return _selectedBar;
_selectedBar = [[UIView alloc] initWithFrame:CGRectMake(0, self.frame.size.height - 5, self.frame.size.width, 5)];
_selectedBar.layer.zPosition = 9999;
_selectedBar.backgroundColor = [UIColor blackColor];
return _selectedBar;
}
@end

View File

@ -0,0 +1,33 @@
//
// XLButtonBarViewCell.h
// XLPagerTabStrip ( https://github.com/xmartlabs/XLPagerTabStrip )
//
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <UIKit/UIKit.h>
@interface XLButtonBarViewCell : UICollectionViewCell
@property (readonly, nonatomic) UIImageView * imageView;
@property (readonly, nonatomic) UILabel * label;
@end

View File

@ -0,0 +1,40 @@
//
// XLButtonBarViewCell.m
// XLPagerTabStrip ( https://github.com/xmartlabs/XLPagerTabStrip )
//
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "XLButtonBarViewCell.h"
@interface XLButtonBarViewCell()
@property IBOutlet UIImageView * imageView;
@property IBOutlet UILabel * label;
@end
@implementation XLButtonBarViewCell
@end

33
XLPagerTabStrip/main.m Normal file
View File

@ -0,0 +1,33 @@
//
// main.m
// XLPagerTabStrip ( https://github.com/xmartlabs/XLPagerTabStrip )
//
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <UIKit/UIKit.h>
#import "AppDelegate.h"
int main(int argc, char * argv[]) {
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
}

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>com.xmartlabs.$(PRODUCT_NAME:rfc1034identifier)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>

View File

@ -0,0 +1,57 @@
//
// XLPagerTabStripTests.m
// XLPagerTabStrip ( https://github.com/xmartlabs/XLPagerTabStrip )
//
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <UIKit/UIKit.h>
#import <XCTest/XCTest.h>
@interface XLPagerTabStripTests : XCTestCase
@end
@implementation XLPagerTabStripTests
- (void)setUp {
[super setUp];
// Put setup code here. This method is called before the invocation of each test method in the class.
}
- (void)tearDown {
// Put teardown code here. This method is called after the invocation of each test method in the class.
[super tearDown];
}
- (void)testExample {
// This is an example of a functional test case.
XCTAssert(YES, @"Pass");
}
- (void)testPerformanceExample {
// This is an example of a performance test case.
[self measureBlock:^{
// Put the code you want to measure the time of here.
}];
}
@end