Merge branch 'master' of github.com:xmartlabs/XLPagerTabStrip

This commit is contained in:
Martin Barreto 2015-04-09 21:06:29 -03:00
commit 6283336bcb
50 changed files with 1096 additions and 72 deletions

BIN
.DS_Store vendored Normal file

Binary file not shown.

2
.gitignore vendored
View File

@ -1,5 +1,5 @@
# Xcode
#
.DS_Store
build/
*.pbxuser
!default.pbxuser

View File

@ -28,6 +28,9 @@
28B63AF11A45B26600225C66 /* XLPagerTabStripViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 28B63AEC1A45B26600225C66 /* XLPagerTabStripViewController.m */; };
28B63AF21A45B26600225C66 /* XLSegmentedPagerTabStripViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 28B63AEE1A45B26600225C66 /* XLSegmentedPagerTabStripViewController.m */; };
28B63AF51A465E5E00225C66 /* ReloadExampleViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 28B63AF41A465E5E00225C66 /* ReloadExampleViewController.m */; };
66C6E4B41AB9D538005361FB /* FXPageControl.m in Sources */ = {isa = PBXBuildFile; fileRef = 66C6E4B11AB9D538005361FB /* FXPageControl.m */; };
66CA35B41A8D174900564221 /* XLTwitterPagerTabStripViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 66CA35B31A8D174900564221 /* XLTwitterPagerTabStripViewController.m */; };
C262204E1AD44A4D002E5226 /* TwitterExampleViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C262204D1AD44A4D002E5226 /* TwitterExampleViewController.m */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@ -82,6 +85,12 @@
28B63AEE1A45B26600225C66 /* XLSegmentedPagerTabStripViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = XLSegmentedPagerTabStripViewController.m; path = Controllers/XLSegmentedPagerTabStripViewController.m; sourceTree = "<group>"; };
28B63AF31A465E5E00225C66 /* ReloadExampleViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ReloadExampleViewController.h; sourceTree = "<group>"; };
28B63AF41A465E5E00225C66 /* ReloadExampleViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ReloadExampleViewController.m; sourceTree = "<group>"; };
66C6E4B01AB9D538005361FB /* FXPageControl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FXPageControl.h; sourceTree = "<group>"; };
66C6E4B11AB9D538005361FB /* FXPageControl.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FXPageControl.m; sourceTree = "<group>"; };
66CA35B21A8D174900564221 /* XLTwitterPagerTabStripViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = XLTwitterPagerTabStripViewController.h; path = Controllers/XLTwitterPagerTabStripViewController.h; sourceTree = "<group>"; };
66CA35B31A8D174900564221 /* XLTwitterPagerTabStripViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = XLTwitterPagerTabStripViewController.m; path = Controllers/XLTwitterPagerTabStripViewController.m; sourceTree = "<group>"; };
C262204C1AD44A4D002E5226 /* TwitterExampleViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TwitterExampleViewController.h; sourceTree = "<group>"; };
C262204D1AD44A4D002E5226 /* TwitterExampleViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TwitterExampleViewController.m; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@ -123,6 +132,7 @@
28B63A881A459F5900225C66 /* XLPagerTabStrip */ = {
isa = PBXGroup;
children = (
66C6E4AF1AB9D538005361FB /* FXPageControl */,
28B63ACC1A45A4CD00225C66 /* XL */,
28B63AAF1A45A4C500225C66 /* Demo */,
28B63A8D1A459F5900225C66 /* AppDelegate.h */,
@ -162,15 +172,17 @@
28B63AAF1A45A4C500225C66 /* Demo */ = {
isa = PBXGroup;
children = (
28B63AB41A45A4C500225C66 /* ChildViewController */,
28B63ABC1A45A4C500225C66 /* Helpers */,
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 */,
C262204C1AD44A4D002E5226 /* TwitterExampleViewController.h */,
C262204D1AD44A4D002E5226 /* TwitterExampleViewController.m */,
28B63ABF1A45A4C500225C66 /* PagerSlidingTabStrip.gif */,
28B63AC21A45A4C500225C66 /* Storyboard.storyboard */,
);
path = Demo;
@ -241,10 +253,21 @@
28B63AEC1A45B26600225C66 /* XLPagerTabStripViewController.m */,
28B63AED1A45B26600225C66 /* XLSegmentedPagerTabStripViewController.h */,
28B63AEE1A45B26600225C66 /* XLSegmentedPagerTabStripViewController.m */,
66CA35B21A8D174900564221 /* XLTwitterPagerTabStripViewController.h */,
66CA35B31A8D174900564221 /* XLTwitterPagerTabStripViewController.m */,
);
name = Controllers;
sourceTree = "<group>";
};
66C6E4AF1AB9D538005361FB /* FXPageControl */ = {
isa = PBXGroup;
children = (
66C6E4B01AB9D538005361FB /* FXPageControl.h */,
66C6E4B11AB9D538005361FB /* FXPageControl.m */,
);
path = FXPageControl;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
@ -294,6 +317,7 @@
TargetAttributes = {
28B63A851A459F5900225C66 = {
CreatedOnToolsVersion = 6.1.1;
DevelopmentTeam = 6F2G55XL63;
};
28B63A9E1A459F5900225C66 = {
CreatedOnToolsVersion = 6.1.1;
@ -348,6 +372,8 @@
28B63AC51A45A4C500225C66 /* ChildExampleViewController.m in Sources */,
28B63AF11A45B26600225C66 /* XLPagerTabStripViewController.m in Sources */,
28B63AC41A45A4C500225C66 /* ButtonBarExampleViewController.m in Sources */,
C262204E1AD44A4D002E5226 /* TwitterExampleViewController.m in Sources */,
66CA35B41A8D174900564221 /* XLTwitterPagerTabStripViewController.m in Sources */,
28B63ADC1A45A4CD00225C66 /* XLBarView.m in Sources */,
28B63AC81A45A4C500225C66 /* XLJSONSerialization.m in Sources */,
28B63ADD1A45A4CD00225C66 /* XLButtonBarView.m in Sources */,
@ -362,6 +388,7 @@
28B63AF01A45B26600225C66 /* XLButtonBarPagerTabStripViewController.m in Sources */,
28B63A8C1A459F5900225C66 /* main.m in Sources */,
28B63AC61A45A4C500225C66 /* TableChildExampleViewController.m in Sources */,
66C6E4B41AB9D538005361FB /* FXPageControl.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};

BIN
XLPagerTabStrip/.DS_Store vendored Normal file

Binary file not shown.

View File

@ -2,7 +2,7 @@
// AppDelegate.h
// XLPagerTabStrip ( https://github.com/xmartlabs/XLPagerTabStrip )
//
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy

View File

@ -2,7 +2,7 @@
// AppDelegate.m
// XLPagerTabStrip ( https://github.com/xmartlabs/XLPagerTabStrip )
//
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy

View File

@ -2,7 +2,7 @@
// BarContainerViewController.h
// XLPagerTabStrip ( https://github.com/xmartlabs/XLPagerTabStrip )
//
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy

View File

@ -2,7 +2,7 @@
// BarContainerViewController.m
// XLPagerTabStrip ( https://github.com/xmartlabs/XLPagerTabStrip )
//
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy

View File

@ -2,7 +2,7 @@
// ButtonContainerViewController.h
// XLPagerTabStrip ( https://github.com/xmartlabs/XLPagerTabStrip )
//
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy

View File

@ -2,7 +2,7 @@
// ButtonContainerViewController.m
// XLPagerTabStrip ( https://github.com/xmartlabs/XLPagerTabStrip )
//
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy

View File

@ -2,7 +2,7 @@
// ChildExampleViewController.h
// XLPagerTabStrip ( https://github.com/xmartlabs/XLPagerTabStrip )
//
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy

View File

@ -2,7 +2,7 @@
// ChildExampleViewController.m
// XLPagerTabStrip ( https://github.com/xmartlabs/XLPagerTabStrip )
//
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy

View File

@ -2,7 +2,7 @@
// TableChildExampleViewController.h
// XLPagerTabStrip ( https://github.com/xmartlabs/XLPagerTabStrip )
//
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy

View File

@ -2,7 +2,7 @@
// TableChildExampleViewController.m
// XLPagerTabStrip ( https://github.com/xmartlabs/XLPagerTabStrip )
//
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy

View File

@ -2,7 +2,7 @@
// PostCell.h
// XLPagerTabStrip ( https://github.com/xmartlabs/XLPagerTabStrip )
//
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy

View File

@ -2,7 +2,7 @@
// PostCell.m
// XLPagerTabStrip ( https://github.com/xmartlabs/XLPagerTabStrip )
//
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy

View File

@ -3,7 +3,7 @@
// XLPagerTabStrip
//
// Created by Martin Barreto on 12/20/14.
// Copyright (c) 2014 Xmartlabs. All rights reserved.
// Copyright (c) 2015 Xmartlabs. All rights reserved.
//
#import <UIKit/UIKit.h>

View File

@ -3,7 +3,7 @@
// XLPagerTabStrip
//
// Created by Martin Barreto on 12/20/14.
// Copyright (c) 2014 Xmartlabs. All rights reserved.
// Copyright (c) 2015 Xmartlabs. All rights reserved.
//
#import "XLPagerTabStripViewController.h"
#import "ReloadExampleViewController.h"
@ -51,19 +51,15 @@
-(void)updateTitle:(XLPagerTabStripViewController *)pagerController
{
NSString * title = @"isProgressiveIndicator = NO";
if (pagerController.isProgressiveIndicator){
if (pagerController.isElasticIndicatorLimit){
title = @"isProgressiveIndicator = YES, isElasticIndicatorLimit = YES";
}
else{
title = @"isProgressiveIndicator = YES, isElasticIndicatorLimit = NO";
}
}
NSString * title = [NSString stringWithFormat:@"Progressive = %@ ElasticLimit = %@",[self stringFromBool:pagerController.isProgressiveIndicator] ,[self stringFromBool:pagerController.isElasticIndicatorLimit]];
self.titleLabel.text = title;
((UILabel *)self.navigationItem.titleView).text = title;
[((UILabel *)self.navigationItem.titleView) sizeToFit];
}
-(NSString *)stringFromBool:(BOOL)value
{
return value ? @"YES" : @"NO";
}
@end

View File

@ -2,7 +2,7 @@
// XLJSONSerialization.h
// XLPagerTabStrip ( https://github.com/xmartlabs/XLPagerTabStrip )
//
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy

View File

@ -2,7 +2,7 @@
// XLJSONSerialization.m
// XLPagerTabStrip ( https://github.com/xmartlabs/XLPagerTabStrip )
//
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy

View File

@ -2,7 +2,7 @@
// SegmentedContainerViewController.h
// XLPagerTabStrip ( https://github.com/xmartlabs/XLPagerTabStrip )
//
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy

View File

@ -2,7 +2,7 @@
// SegmentedContainerViewController.m
// XLPagerTabStrip ( https://github.com/xmartlabs/XLPagerTabStrip )
//
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy

View File

@ -1,7 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6254" systemVersion="14C109" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="ptL-BW-nEP">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6751" systemVersion="14C109" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="ptL-BW-nEP">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6247"/>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6736"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
</dependencies>
<scenes>
@ -14,12 +15,12 @@
<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"/>
<rect key="frame" x="0.0" y="0.0" 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"/>
<color key="backgroundColor" red="0.93725490196078431" green="0.93725490196078431" blue="0.95686274509803926" alpha="1" colorSpace="calibratedRGB"/>
</scrollView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
@ -56,9 +57,9 @@
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="7KA-v4-CBs" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="2227.5" y="-583.09859154929575"/>
<point key="canvasLocation" x="2214" y="-1341"/>
</scene>
<!--Reload Example View Controller-->
<!--Bar-->
<scene sceneID="sWd-rV-F4O">
<objects>
<viewController id="uba-Iz-2L2" customClass="ReloadExampleViewController" sceneMemberID="viewController">
@ -87,8 +88,8 @@
</connections>
</button>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Storyboard Demo" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumScaleFactor="0.5" 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"/>
<rect key="frame" x="230" y="52" width="140" height="21"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="17"/>
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
@ -119,7 +120,9 @@
</mask>
</variation>
</view>
<tabBarItem key="tabBarItem" systemItem="contacts" id="1d9-i6-g9L"/>
<tabBarItem key="tabBarItem" title="Bar" image="logoCircle" id="1d9-i6-g9L">
<offsetWrapper key="titlePositionAdjustment" horizontal="0.0" vertical="-2"/>
</tabBarItem>
<navigationItem key="navigationItem" id="ni8-Kh-JRq"/>
<connections>
<outlet property="titleLabel" destination="cZN-qT-VUq" id="tRG-O0-13z"/>
@ -127,7 +130,7 @@
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="jkN-pv-eFH" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1339.5" y="138.75"/>
<point key="canvasLocation" x="1329" y="-2161"/>
</scene>
<!--Buttons Example-->
<scene sceneID="c3d-TB-Hyh">
@ -167,7 +170,7 @@
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="79T-iZ-rpA" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="2225.625" y="917.95774647887322"/>
<point key="canvasLocation" x="2214" y="-527"/>
</scene>
<!--Bar Example View Controller-->
<scene sceneID="Ufs-nK-0Io">
@ -190,7 +193,7 @@
</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"/>
<color key="backgroundColor" red="0.93725490196078431" green="0.93725490196078431" blue="0.95686274509803926" alpha="1" colorSpace="calibratedRGB"/>
</scrollView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
@ -212,7 +215,7 @@
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="cKU-zQ-C4r" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="2227.5" y="139.43661971830986"/>
<point key="canvasLocation" x="2214" y="-2161"/>
</scene>
<!--Tab Bar Controller-->
<scene sceneID="Lv9-yU-Knu">
@ -228,17 +231,20 @@
<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"/>
<segue destination="uPL-4b-W3j" kind="relationship" relationship="viewControllers" id="Ovh-Wq-NjP"/>
</connections>
</tabBarController>
<placeholder placeholderIdentifier="IBFirstResponder" id="YsA-SS-Qae" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="208.125" y="148.94366197183098"/>
<point key="canvasLocation" x="176" y="-957"/>
</scene>
<!--Navigation Controller-->
<!--Segmented-->
<scene sceneID="gqT-2d-jBf">
<objects>
<navigationController id="g7J-zS-0bu" sceneMemberID="viewController">
<tabBarItem key="tabBarItem" systemItem="mostViewed" id="cv3-rF-uFc"/>
<tabBarItem key="tabBarItem" title="Segmented" image="logoCircle" id="cv3-rF-uFc">
<offsetWrapper key="titlePositionAdjustment" horizontal="0.0" vertical="-2"/>
</tabBarItem>
<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"/>
@ -247,24 +253,27 @@
</navigationBar>
<nil name="viewControllers"/>
<connections>
<segue destination="h8P-u9-NhP" kind="relationship" relationship="rootViewController" id="l8V-Zr-SH8"/>
<segue destination="h8P-u9-NhP" kind="relationship" relationship="rootViewController" id="Srv-IP-2eX"/>
</connections>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="lsc-9V-4Tm" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1327.5" y="-583.09859154929575"/>
<point key="canvasLocation" x="1329" y="-1341"/>
</scene>
<!--Navigation Controller-->
<!--Button-->
<scene sceneID="aQc-cn-j2T">
<objects>
<navigationController automaticallyAdjustsScrollViewInsets="NO" id="jWp-2W-r7X" sceneMemberID="viewController">
<tabBarItem key="tabBarItem" systemItem="favorites" id="xNX-u1-4Tr"/>
<tabBarItem key="tabBarItem" title="Button" image="logoCircle" id="xNX-u1-4Tr">
<offsetWrapper key="titlePositionAdjustment" horizontal="0.0" vertical="-2"/>
</tabBarItem>
<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">
<fontDescription key="fontDescription" type="boldSystem" pointSize="17"/>
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</textAttributes>
</navigationBar>
@ -275,7 +284,7 @@
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="U4T-yC-y5O" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1340.625" y="917.95774647887322"/>
<point key="canvasLocation" x="1329" y="-527"/>
</scene>
<!--Button Bar Example View Controller-->
<scene sceneID="Ctn-j0-KV6">
@ -330,7 +339,7 @@
</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"/>
<color key="backgroundColor" red="0.93725490196078431" green="0.93725490196078431" blue="0.95686274509803926" alpha="1" colorSpace="calibratedRGB"/>
</view>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
@ -352,7 +361,75 @@
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="ls9-Xb-7by" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="3035.625" y="917.42957746478862"/>
<point key="canvasLocation" x="3022" y="-527.5"/>
</scene>
<!--Twitter Example View Controller-->
<scene sceneID="Zfp-Dk-WxL">
<objects>
<viewController id="Vhq-do-uI2" customClass="TwitterExampleViewController" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="OfJ-gb-drI"/>
<viewControllerLayoutGuide type="bottom" id="64r-dM-ghd"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="Eak-dg-otx">
<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="A96-PT-Aon">
<rect key="frame" x="0.0" y="0.0" width="600" height="487"/>
<color key="backgroundColor" red="0.93725490196078431" green="0.93725490196078431" blue="0.95686274509803926" alpha="1" colorSpace="calibratedRGB"/>
</scrollView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="A96-PT-Aon" firstAttribute="top" secondItem="OfJ-gb-drI" secondAttribute="bottom" id="Hq8-hS-mpA"/>
<constraint firstItem="A96-PT-Aon" firstAttribute="leading" secondItem="Eak-dg-otx" secondAttribute="leading" id="WLj-sR-uGh"/>
<constraint firstItem="64r-dM-ghd" firstAttribute="top" secondItem="A96-PT-Aon" secondAttribute="bottom" id="WbQ-8w-VJ6"/>
<constraint firstAttribute="trailing" secondItem="A96-PT-Aon" secondAttribute="trailing" id="qxY-dq-VCq"/>
</constraints>
</view>
<extendedEdge key="edgesForExtendedLayout" top="YES"/>
<navigationItem key="navigationItem" id="0Xx-RA-ktC">
<nil key="title"/>
<barButtonItem key="rightBarButtonItem" systemItem="refresh" id="mhz-8g-Ux7">
<color key="tintColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<connections>
<action selector="reloadTapped:" destination="Vhq-do-uI2" id="C47-dn-jtz"/>
</connections>
</barButtonItem>
</navigationItem>
<connections>
<outlet property="containerView" destination="A96-PT-Aon" id="7oh-72-sHX"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="6HK-op-tmY" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="2214" y="328"/>
</scene>
<!--Twitter-->
<scene sceneID="xRb-7u-bt9">
<objects>
<navigationController id="uPL-4b-W3j" sceneMemberID="viewController">
<tabBarItem key="tabBarItem" title="Twitter" image="logoCircle" id="Iyb-I5-OSg">
<offsetWrapper key="titlePositionAdjustment" horizontal="0.0" vertical="-2"/>
</tabBarItem>
<toolbarItems/>
<navigationBar key="navigationBar" opaque="NO" contentMode="scaleToFill" translucent="NO" id="iMm-hr-oOU">
<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="Vhq-do-uI2" kind="relationship" relationship="rootViewController" id="rTN-Tc-B3c"/>
</connections>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="O48-vq-kph" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1329" y="328"/>
</scene>
</scenes>
<resources>
<image name="logoCircle" width="28" height="28"/>
</resources>
</document>

View File

@ -0,0 +1,13 @@
//
// TwitterExampleViewController.h
// XLPagerTabStrip
//
// Created by Archibald on 4/7/15.
// Copyright (c) 2015 Xmartlabs. All rights reserved.
//
#import "XLTwitterPagerTabStripViewController.h"
@interface TwitterExampleViewController : XLTwitterPagerTabStripViewController
@end

View File

@ -0,0 +1,61 @@
//
// TwitterExampleViewController.m
// XLPagerTabStrip
//
// Created by Archibald on 4/7/15.
// Copyright (c) 2015 Xmartlabs. All rights reserved.
//
#import "TableChildExampleViewController.h"
#import "ChildExampleViewController.h"
#import "TwitterExampleViewController.h"
@implementation TwitterExampleViewController
{
BOOL _isReload;
}
- (void)viewDidLoad {
[super viewDidLoad];
_isReload = NO;
self.isProgressiveIndicator = YES;
self.isElasticIndicatorLimit = YES;
// Do any additional setup after loading the view.
}
#pragma mark - XLPagerTabStripViewControllerDataSource
-(NSArray *)childViewControllersForPagerTabStripViewController:(XLPagerTabStripViewController *)pagerTabStripViewController
{
// create child view controllers that will be managed by XLPagerTabStripViewController
TableChildExampleViewController * child_1 = [[TableChildExampleViewController alloc] initWithStyle:UITableViewStylePlain];
ChildExampleViewController * child_2 = [[ChildExampleViewController alloc] init];
TableChildExampleViewController * child_3 = [[TableChildExampleViewController alloc] initWithStyle:UITableViewStyleGrouped];
ChildExampleViewController * child_4 = [[ChildExampleViewController alloc] init];
TableChildExampleViewController * child_5 = [[TableChildExampleViewController alloc] initWithStyle:UITableViewStylePlain];
ChildExampleViewController * child_6 = [[ChildExampleViewController alloc] init];
TableChildExampleViewController * child_7 = [[TableChildExampleViewController alloc] initWithStyle:UITableViewStyleGrouped];
ChildExampleViewController * child_8 = [[ChildExampleViewController alloc] init];
if (!_isReload){
return @[child_1, child_2, child_3, child_4, child_5, child_6, child_7, child_8];
}
NSMutableArray * childViewControllers = [NSMutableArray arrayWithObjects:child_1, child_2, child_3, child_4, child_5, child_6, child_7, child_8, nil];
NSUInteger count = [childViewControllers count];
for (NSUInteger i = 0; i < count; ++i) {
// Select a random element between i and end of array to swap with.
NSUInteger nElements = count - i;
NSUInteger n = (arc4random() % nElements) + i;
[childViewControllers exchangeObjectAtIndex:i withObjectAtIndex:n];
}
NSUInteger nItems = 1 + (rand() % 8);
return [childViewControllers subarrayWithRange:NSMakeRange(0, nItems)];
}
- (IBAction)reloadTapped:(id)sender {
_isReload = YES;
[self reloadPagerTabStripView];
}
@end

View File

@ -0,0 +1,106 @@
//
// FXPageControl.h
//
// Version 1.4
//
// Created by Nick Lockwood on 07/01/2010.
// Copyright 2010 Charcoal Design
//
// Distributed under the permissive zlib License
// Get the latest version of FXPageControl from here:
//
// https://github.com/nicklockwood/FXPageControl
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software
// in a product, an acknowledgment in the product documentation would be
// appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such, and must not be
// misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
//
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wobjc-missing-property-synthesis"
#import <UIKit/UIKit.h>
#import <Availability.h>
#undef weak_delegate
#if __has_feature(objc_arc_weak)
#define weak_delegate weak
#else
#define weak_delegate unsafe_unretained
#endif
extern const CGPathRef FXPageControlDotShapeCircle;
extern const CGPathRef FXPageControlDotShapeSquare;
extern const CGPathRef FXPageControlDotShapeTriangle;
@protocol FXPageControlDelegate;
IB_DESIGNABLE @interface FXPageControl : UIControl
- (void)setUp;
- (CGSize)sizeForNumberOfPages:(NSInteger)pageCount;
- (void)updateCurrentPageDisplay;
@property (nonatomic, weak_delegate) IBOutlet id <FXPageControlDelegate> delegate;
@property (nonatomic, assign) IBInspectable NSInteger currentPage;
@property (nonatomic, assign) IBInspectable NSInteger numberOfPages;
@property (nonatomic, assign) IBInspectable BOOL defersCurrentPageDisplay;
@property (nonatomic, assign) IBInspectable BOOL hidesForSinglePage;
@property (nonatomic, assign, getter = isWrapEnabled) IBInspectable BOOL wrapEnabled;
@property (nonatomic, assign, getter = isVertical) IBInspectable BOOL vertical;
@property (nonatomic, strong) IBInspectable UIImage *dotImage;
@property (nonatomic, assign) IBInspectable CGPathRef dotShape;
@property (nonatomic, assign) IBInspectable CGFloat dotSize;
@property (nonatomic, strong) IBInspectable UIColor *dotColor;
@property (nonatomic, strong) IBInspectable UIColor *dotShadowColor;
@property (nonatomic, assign) IBInspectable CGFloat dotShadowBlur;
@property (nonatomic, assign) IBInspectable CGSize dotShadowOffset;
@property (nonatomic, strong) IBInspectable UIImage *selectedDotImage;
@property (nonatomic, assign) IBInspectable CGPathRef selectedDotShape;
@property (nonatomic, assign) IBInspectable CGFloat selectedDotSize;
@property (nonatomic, strong) IBInspectable UIColor *selectedDotColor;
@property (nonatomic, strong) IBInspectable UIColor *selectedDotShadowColor;
@property (nonatomic, assign) IBInspectable CGFloat selectedDotShadowBlur;
@property (nonatomic, assign) IBInspectable CGSize selectedDotShadowOffset;
@property (nonatomic, assign) IBInspectable CGFloat dotSpacing;
@end
@protocol FXPageControlDelegate <NSObject>
@optional
- (UIImage *)pageControl:(FXPageControl *)pageControl imageForDotAtIndex:(NSInteger)index;
- (CGPathRef)pageControl:(FXPageControl *)pageControl shapeForDotAtIndex:(NSInteger)index;
- (UIColor *)pageControl:(FXPageControl *)pageControl colorForDotAtIndex:(NSInteger)index;
- (UIImage *)pageControl:(FXPageControl *)pageControl selectedImageForDotAtIndex:(NSInteger)index;
- (CGPathRef)pageControl:(FXPageControl *)pageControl selectedShapeForDotAtIndex:(NSInteger)index;
- (UIColor *)pageControl:(FXPageControl *)pageControl selectedColorForDotAtIndex:(NSInteger)index;
@end
#pragma GCC diagnostic pop

View File

@ -0,0 +1,433 @@
//
// FXPageControl.m
//
// Version 1.4
//
// Created by Nick Lockwood on 07/01/2010.
// Copyright 2010 Charcoal Design
//
// Distributed under the permissive zlib License
// Get the latest version of FXPageControl from here:
//
// https://github.com/nicklockwood/FXPageControl
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software
// in a product, an acknowledgment in the product documentation would be
// appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such, and must not be
// misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
//
#import "FXPageControl.h"
#pragma GCC diagnostic ignored "-Wgnu"
#pragma GCC diagnostic ignored "-Wreceiver-is-weak"
#pragma GCC diagnostic ignored "-Warc-repeated-use-of-weak"
#pragma GCC diagnostic ignored "-Wdirect-ivar-access"
#import <Availability.h>
#if !__has_feature(objc_arc)
#error This class requires automatic reference counting
#endif
const CGPathRef FXPageControlDotShapeCircle = (const CGPathRef)1;
const CGPathRef FXPageControlDotShapeSquare = (const CGPathRef)2;
const CGPathRef FXPageControlDotShapeTriangle = (const CGPathRef)3;
#define LAST_SHAPE FXPageControlDotShapeTriangle
@implementation NSObject (FXPageControl)
- (UIImage *)pageControl:(__unused FXPageControl *)pageControl imageForDotAtIndex:(__unused NSInteger)index { return nil; }
- (CGPathRef)pageControl:(__unused FXPageControl *)pageControl shapeForDotAtIndex:(__unused NSInteger)index { return NULL; }
- (UIColor *)pageControl:(__unused FXPageControl *)pageControl colorForDotAtIndex:(__unused NSInteger)index { return nil; }
- (UIImage *)pageControl:(__unused FXPageControl *)pageControl selectedImageForDotAtIndex:(__unused NSInteger)index { return nil; }
- (CGPathRef)pageControl:(__unused FXPageControl *)pageControl selectedShapeForDotAtIndex:(__unused NSInteger)index { return NULL; }
- (UIColor *)pageControl:(__unused FXPageControl *)pageControl selectedColorForDotAtIndex:(__unused NSInteger)index { return nil; }
@end
@implementation FXPageControl
- (void)setUp
{
//needs redrawing if bounds change
self.contentMode = UIViewContentModeRedraw;
//set defaults
_dotSpacing = 10.0f;
_dotSize = 6.0f;
_dotShadowOffset = CGSizeMake(0, 1);
_selectedDotShadowOffset = CGSizeMake(0, 1);
}
- (id)initWithFrame:(CGRect)frame
{
if ((self = [super initWithFrame:frame]))
{
[self setUp];
}
return self;
}
- (id)initWithCoder:(NSCoder *)aDecoder
{
if ((self = [super initWithCoder:aDecoder]))
{
[self setUp];
}
return self;
}
- (void)dealloc
{
if (_dotShape > LAST_SHAPE) CGPathRelease(_dotShape);
if (_selectedDotShape > LAST_SHAPE) CGPathRelease(_selectedDotShape);
}
- (CGSize)sizeForNumberOfPages:(__unused NSInteger)pageCount
{
CGFloat width = _dotSize + (_dotSize + _dotSpacing) * (_numberOfPages - 1);
return _vertical? CGSizeMake(_dotSize, width): CGSizeMake(width, _dotSize);
}
- (void)updateCurrentPageDisplay
{
[self setNeedsDisplay];
}
- (void)drawRect:(__unused CGRect)rect
{
if (_numberOfPages > 1 || !_hidesForSinglePage)
{
CGContextRef context = UIGraphicsGetCurrentContext();
CGSize size = [self sizeForNumberOfPages:_numberOfPages];
if (_vertical)
{
CGContextTranslateCTM(context, self.frame.size.width / 2, (self.frame.size.height - size.height) / 2);
}
else
{
CGContextTranslateCTM(context, (self.frame.size.width - size.width) / 2, self.frame.size.height / 2);
}
for (int i = 0; i < _numberOfPages; i++)
{
UIImage *dotImage = nil;
UIColor *dotColor = nil;
CGPathRef dotShape = NULL;
CGFloat dotSize = 0;
UIColor *dotShadowColor = nil;
CGSize dotShadowOffset = CGSizeZero;
CGFloat dotShadowBlur = 0;
if (i == _currentPage)
{
[_selectedDotColor setFill];
dotImage = [_delegate pageControl:self selectedImageForDotAtIndex:i] ?: _selectedDotImage;
dotShape = [_delegate pageControl:self selectedShapeForDotAtIndex:i] ?: _selectedDotShape ?: _dotShape;
dotColor = [_delegate pageControl:self selectedColorForDotAtIndex:i] ?: _selectedDotColor ?: [UIColor blackColor];
dotShadowBlur = _selectedDotShadowBlur;
dotShadowColor = _selectedDotShadowColor;
dotShadowOffset = _selectedDotShadowOffset;
dotSize = _selectedDotSize ?: _dotSize;
}
else
{
[_dotColor setFill];
dotImage = [_delegate pageControl:self imageForDotAtIndex:i] ?: _dotImage;
dotShape = [_delegate pageControl:self shapeForDotAtIndex:i] ?: _dotShape;
dotColor = [_delegate pageControl:self colorForDotAtIndex:i] ?: _dotColor;
if (!dotColor)
{
//fall back to selected dot color with reduced alpha
dotColor = [_delegate pageControl:self selectedColorForDotAtIndex:i] ?: _selectedDotColor ?: [UIColor blackColor];
dotColor = [dotColor colorWithAlphaComponent:0.25f];
}
dotShadowBlur = _dotShadowBlur;
dotShadowColor = _dotShadowColor;
dotShadowOffset = _dotShadowOffset;
dotSize = _dotSize;
}
CGContextSaveGState(context);
CGFloat offset = (_dotSize + _dotSpacing) * i + _dotSize / 2;
CGContextTranslateCTM(context, _vertical? 0: offset, _vertical? offset: 0);
if (dotShadowColor && ![dotShadowColor isEqual:[UIColor clearColor]])
{
CGContextSetShadowWithColor(context, dotShadowOffset, dotShadowBlur, dotShadowColor.CGColor);
}
if (dotImage)
{
[dotImage drawInRect:CGRectMake(-dotImage.size.width / 2, -dotImage.size.height / 2, dotImage.size.width, dotImage.size.height)];
}
else
{
[dotColor setFill];
if (!dotShape || dotShape == FXPageControlDotShapeCircle)
{
CGContextFillEllipseInRect(context, CGRectMake(-dotSize / 2, -dotSize / 2, dotSize, dotSize));
}
else if (dotShape == FXPageControlDotShapeSquare)
{
CGContextFillRect(context, CGRectMake(-dotSize / 2, -dotSize / 2, dotSize, dotSize));
}
else if (dotShape == FXPageControlDotShapeTriangle)
{
CGContextBeginPath(context);
CGContextMoveToPoint(context, 0, -dotSize / 2);
CGContextAddLineToPoint(context, dotSize / 2, dotSize / 2);
CGContextAddLineToPoint(context, -dotSize / 2, dotSize / 2);
CGContextAddLineToPoint(context, 0, -dotSize / 2);
CGContextFillPath(context);
}
else
{
CGContextBeginPath(context);
CGContextAddPath(context, dotShape);
CGContextFillPath(context);
}
}
CGContextRestoreGState(context);
}
}
}
- (NSInteger)clampedPageValue:(NSInteger)page
{
if (_wrapEnabled)
{
return _numberOfPages? (page + _numberOfPages) % _numberOfPages: 0;
}
else
{
return MIN(MAX(0, page), _numberOfPages - 1);
}
}
- (void)setDotImage:(UIImage *)dotImage
{
if (_dotImage != dotImage)
{
_dotImage = dotImage;
[self setNeedsDisplay];
}
}
- (void)setDotShape:(CGPathRef)dotShape
{
if (_dotShape != dotShape)
{
if (_dotShape > LAST_SHAPE) CGPathRelease(_dotShape);
_dotShape = dotShape;
if (_dotShape > LAST_SHAPE) CGPathRetain(_dotShape);
[self setNeedsDisplay];
}
}
- (void)setDotSize:(CGFloat)dotSize
{
if (ABS(_dotSize - dotSize) > 0.001)
{
_dotSize = dotSize;
[self setNeedsDisplay];
}
}
- (void)setDotColor:(UIColor *)dotColor
{
if (_dotColor != dotColor)
{
_dotColor = dotColor;
[self setNeedsDisplay];
}
}
- (void)setDotShadowColor:(UIColor *)dotColor
{
if (_dotShadowColor != dotColor)
{
_dotShadowColor = dotColor;
[self setNeedsDisplay];
}
}
- (void)setDotShadowBlur:(CGFloat)dotShadowBlur
{
if (ABS(_dotShadowBlur - dotShadowBlur) > 0.001)
{
_dotShadowBlur = dotShadowBlur;
[self setNeedsDisplay];
}
}
- (void)setDotShadowOffset:(CGSize)dotShadowOffset
{
if (!CGSizeEqualToSize(_dotShadowOffset, dotShadowOffset))
{
_dotShadowOffset = dotShadowOffset;
[self setNeedsDisplay];
}
}
- (void)setSelectedDotImage:(UIImage *)dotImage
{
if (_selectedDotImage != dotImage)
{
_selectedDotImage = dotImage;
[self setNeedsDisplay];
}
}
- (void)setSelectedDotColor:(UIColor *)dotColor
{
if (_selectedDotColor != dotColor)
{
_selectedDotColor = dotColor;
[self setNeedsDisplay];
}
}
- (void)setSelectedDotShape:(CGPathRef)dotShape
{
if (_selectedDotShape != dotShape)
{
if (_selectedDotShape > LAST_SHAPE) CGPathRelease(_selectedDotShape);
_selectedDotShape = dotShape;
if (_selectedDotShape > LAST_SHAPE) CGPathRetain(_selectedDotShape);
[self setNeedsDisplay];
}
}
- (void)setSelectedDotSize:(CGFloat)dotSize
{
if (ABS(_selectedDotSize - dotSize) > 0.001)
{
_selectedDotSize = dotSize;
[self setNeedsDisplay];
}
}
- (void)setSelectedDotShadowColor:(UIColor *)dotColor
{
if (_selectedDotShadowColor != dotColor)
{
_selectedDotShadowColor = dotColor;
[self setNeedsDisplay];
}
}
- (void)setSelectedDotShadowBlur:(CGFloat)dotShadowBlur
{
if (ABS(_selectedDotShadowBlur - dotShadowBlur) > 0.001)
{
_selectedDotShadowBlur = dotShadowBlur;
[self setNeedsDisplay];
}
}
- (void)setSelectedDotShadowOffset:(CGSize)dotShadowOffset
{
if (!CGSizeEqualToSize(_selectedDotShadowOffset, dotShadowOffset))
{
_selectedDotShadowOffset = dotShadowOffset;
[self setNeedsDisplay];
}
}
- (void)setDotSpacing:(CGFloat)dotSpacing
{
if (ABS(_dotSpacing - dotSpacing) > 0.001)
{
_dotSpacing = dotSpacing;
[self setNeedsDisplay];
}
}
- (void)setDelegate:(id<FXPageControlDelegate>)delegate
{
if (_delegate != delegate)
{
_delegate = delegate;
[self setNeedsDisplay];
}
}
- (void)setCurrentPage:(NSInteger)page
{
_currentPage = [self clampedPageValue:page];
[self setNeedsDisplay];
}
- (void)setNumberOfPages:(NSInteger)pages
{
if (_numberOfPages != pages)
{
_numberOfPages = pages;
if (_currentPage >= pages)
{
_currentPage = pages - 1;
}
[self setNeedsDisplay];
}
}
- (void)endTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)event
{
CGPoint point = [touch locationInView:self];
BOOL forward = _vertical? (point.y > self.frame.size.height / 2): (point.x > self.frame.size.width / 2);
_currentPage = [self clampedPageValue:_currentPage + (forward? 1: -1)];
if (!_defersCurrentPageDisplay)
{
[self setNeedsDisplay];
}
[self sendActionsForControlEvents:UIControlEventValueChanged];
[super endTrackingWithTouch:touch withEvent:event];
}
- (CGSize)sizeThatFits:(__unused CGSize)size
{
CGSize dotSize = [self sizeForNumberOfPages:_numberOfPages];
if (_selectedDotSize)
{
CGFloat width = (_selectedDotSize - _dotSize);
CGFloat height = MAX(36, MAX(_dotSize, _selectedDotSize));
dotSize.width = _vertical? height: dotSize.width + width;
dotSize.height = _vertical? dotSize.height + width: height;
}
if ((_dotShadowColor && ![_dotShadowColor isEqual:[UIColor clearColor]]) ||
(_selectedDotShadowColor && ![_selectedDotShadowColor isEqual:[UIColor clearColor]]))
{
dotSize.width += MAX(_dotShadowOffset.width, _selectedDotShadowOffset.width) * 2;
dotSize.height += MAX(_dotShadowOffset.height, _selectedDotShadowOffset.height) * 2;
dotSize.width += MAX(_dotShadowBlur, _selectedDotShadowBlur) * 2;
dotSize.height += MAX(_dotShadowBlur, _selectedDotShadowBlur) * 2;
}
return dotSize;
}
- (CGSize)intrinsicContentSize
{
return [self sizeThatFits:self.bounds.size];
}
@end

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
XLPagerTabStrip/XL/.DS_Store vendored Normal file

Binary file not shown.

BIN
XLPagerTabStrip/XL/Controllers/.DS_Store vendored Normal file

Binary file not shown.

View File

@ -2,7 +2,7 @@
// XLBarPagerTabStripViewController.h
// XLPagerTabStrip ( https://github.com/xmartlabs/XLPagerTabStrip )
//
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy

View File

@ -2,7 +2,7 @@
// XLBarPagerTabStripViewController.m
// XLPagerTabStrip ( https://github.com/xmartlabs/XLPagerTabStrip )
//
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy

View File

@ -2,7 +2,7 @@
// XLButtonBarPagerTabStripViewController.h
// XLPagerTabStrip ( https://github.com/xmartlabs/XLPagerTabStrip )
//
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy

View File

@ -2,7 +2,7 @@
// XLButtonBarPagerTabStripViewController.m
// XLPagerTabStrip ( https://github.com/xmartlabs/XLPagerTabStrip )
//
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy

View File

@ -2,7 +2,7 @@
// XLPagerTabStripViewController.h
// XLPagerTabStrip ( https://github.com/xmartlabs/XLPagerTabStrip )
//
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy

View File

@ -2,7 +2,7 @@
// XLPagerTabStripViewController
// XLPagerTabStrip ( https://github.com/xmartlabs/XLPagerTabStrip )
//
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
@ -156,12 +156,14 @@
-(void)pagerTabStripViewController:(XLPagerTabStripViewController *)pagerTabStripViewController
updateIndicatorFromIndex:(NSInteger)fromIndex
toIndex:(NSInteger)toIndex{
}
-(void)pagerTabStripViewController:(XLPagerTabStripViewController *)pagerTabStripViewController
updateIndicatorFromIndex:(NSInteger)fromIndex
toIndex:(NSInteger)toIndex
withProgressPercentage:(CGFloat)progressPercentage{
withProgressPercentage:(CGFloat)progressPercentage
{
}

View File

@ -2,7 +2,7 @@
// XLSegmentedPagerTabStripViewController.h
// XLPagerTabStrip ( https://github.com/xmartlabs/XLPagerTabStrip )
//
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy

View File

@ -2,7 +2,7 @@
// XLSegmentedPagerTabStripViewController.m
// XLPagerTabStrip ( https://github.com/xmartlabs/XLPagerTabStrip )
//
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy

View File

@ -0,0 +1,32 @@
//
// XLTwitterPagerTabStripViewController.h
// XLPagerTabStrip ( https://github.com/xmartlabs/XLPagerTabStrip )
//
// Copyright (c) 2015 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 XLTwitterPagerTabStripViewController : XLPagerTabStripViewController
@property (nonatomic, readonly) UIView * navigationView;
@end

View File

@ -0,0 +1,255 @@
//
// XLTwitterPagerTabStripViewController.m
// XLPagerTabStrip ( https://github.com/xmartlabs/XLPagerTabStrip )
//
// Copyright (c) 2015 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 "XLTwitterPagerTabStripViewController.h"
#import "TableChildExampleViewController.h"
#import "ChildExampleViewController.h"
#import "FXPageControl.h"
@interface XLTwitterPagerTabStripViewController ()
@property (nonatomic) UIView * navigationView;
@property (nonatomic) UIScrollView * navigationScrollView;
@property (nonatomic) FXPageControl * navigationPageControl;
@property (nonatomic, strong) NSMutableArray * navigationItemsViews;
@end
@implementation XLTwitterPagerTabStripViewController
- (void)viewDidLoad
{
[super viewDidLoad];
if (!self.navigationView.superview) {
self.navigationItem.titleView = self.navigationView;
}
if (!self.navigationScrollView.superview) {
[self.navigationView addSubview:self.navigationScrollView];
}
if (!self.navigationPageControl.superview) {
[self.navigationView addSubview:self.navigationPageControl];
}
[self reloadNavigationViewItems];
}
-(void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
[self.navigationView setFrame:CGRectMake(0, 0, CGRectGetWidth(self.navigationController.navigationBar.frame) , CGRectGetHeight(self.navigationController.navigationBar.frame))];
[self.navigationView addObserver:self forKeyPath:@"frame" options:NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld context:0];
}
-(void)reloadPagerTabStripView
{
[super reloadPagerTabStripView];
if ([self isViewLoaded])
{
[self reloadNavigationViewItems];
[self setNavigationViewItemsPosition];
}
}
-(void)setIsProgressiveIndicator:(BOOL)isProgressiveIndicator
{
[super setIsProgressiveIndicator:YES];
}
#pragma mark - Properties
-(UIView *)navigationView
{
if (_navigationView) return _navigationView;
_navigationView = [[UIView alloc] init];
_navigationView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
return _navigationView;
}
- (UIScrollView *)navigationScrollView
{
if (_navigationScrollView) return _navigationScrollView;
_navigationScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth(self.view.bounds), 44)];
_navigationScrollView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
_navigationScrollView.bounces = YES;
_navigationScrollView.scrollsToTop = NO;
_navigationScrollView.delegate = self;
_navigationScrollView.showsVerticalScrollIndicator = NO;
_navigationScrollView.showsHorizontalScrollIndicator = NO;
_navigationScrollView.pagingEnabled = YES;
_navigationScrollView.userInteractionEnabled = NO;
[_navigationScrollView setAlwaysBounceHorizontal:YES];
[_navigationScrollView setAlwaysBounceVertical:NO];
return _navigationScrollView;
}
-(NSMutableArray *)navigationItemsViews
{
if (_navigationItemsViews) return _navigationItemsViews;
_navigationItemsViews = [[NSMutableArray alloc] init];
return _navigationItemsViews;
}
-(FXPageControl *)navigationPageControl
{
if (_navigationPageControl) return _navigationPageControl;
_navigationPageControl = [[FXPageControl alloc] init];
[_navigationPageControl setBackgroundColor:[UIColor clearColor]];
[_navigationPageControl setDotSize:3.8f];
[_navigationPageControl setDotSpacing:4.0f];
[_navigationPageControl setDotColor:[UIColor colorWithWhite:1 alpha:0.4]];
[_navigationPageControl setSelectedDotColor:[UIColor whiteColor]];
return _navigationPageControl;
}
#pragma mark - XLPagerTabStripViewControllerDataSource
-(void)pagerTabStripViewController:(XLPagerTabStripViewController *)pagerTabStripViewController
updateIndicatorFromIndex:(NSInteger)fromIndex
toIndex:(NSInteger)toIndex
{
// not accept no progressive indicator
}
-(void)pagerTabStripViewController:(XLPagerTabStripViewController *)pagerTabStripViewController
updateIndicatorFromIndex:(NSInteger)fromIndex
toIndex:(NSInteger)toIndex
withProgressPercentage:(CGFloat)progressPercentage
{
CGFloat distance = [self getDistanceValue];
UIAccelerationValue xOffset = fromIndex < toIndex ? distance * fromIndex + distance * progressPercentage : distance * fromIndex - distance * progressPercentage;
[self.navigationScrollView setContentOffset:CGPointMake(xOffset, 0)];
[self setAlphaWithOffset:xOffset];
[_navigationPageControl setCurrentPage:self.currentIndex];
}
#pragma mark - KVO
-(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
{
if ((object == self.navigationItem.titleView && [keyPath isEqualToString:@"frame"])){
if ([[change objectForKey:NSKeyValueChangeKindKey] isEqualToNumber:@(NSKeyValueChangeSetting)]){
CGRect oldRect = [change[NSKeyValueChangeOldKey] CGRectValue];
CGRect newRect = [change[NSKeyValueChangeNewKey] CGRectValue];
if (!CGRectEqualToRect(newRect,oldRect)) {
[self.navigationScrollView setFrame:CGRectMake(0, 0, CGRectGetWidth(self.navigationView.frame) , CGRectGetHeight(self.navigationScrollView.frame))];
[self setNavigationViewItemsPosition];
}
}
}
}
-(void)dealloc
{
[self.navigationView removeObserver:self forKeyPath:@"frame"];
}
#pragma mark - Helpers
-(void)reloadNavigationViewItems
{
[self.navigationItemsViews enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
[obj removeFromSuperview];
}];
[self.navigationItemsViews removeAllObjects];
[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(titleForPagerTabStripViewController:)]){
UILabel *navTitleLabel = [self createNewLabelWithText:[childViewController titleForPagerTabStripViewController:self]];
[navTitleLabel setAlpha: self.currentIndex == idx ? 1 : 0];
[_navigationScrollView addSubview:navTitleLabel];
[_navigationItemsViews addObject:navTitleLabel];
}
}];
}
-(void)setNavigationViewItemsPosition
{
CGFloat distance = [self getDistanceValue];
[self.navigationItemsViews enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
int index = (int)idx;
UIView *view = (UIView *)obj;
[view setAlpha: self.currentIndex == idx ? 1 : 0];
CGSize viewSize = [view isKindOfClass:[UILabel class]] ? [self getLabelSize:(UILabel*)view] : view.frame.size;
CGFloat originX = (distance - viewSize.width/2) + index * distance;
view.frame = (CGRect){originX, 8, viewSize.width, viewSize.height};
view.tag = index;
}];
UIAccelerationValue xOffset = distance * self.currentIndex;
[self.navigationScrollView setContentOffset:CGPointMake(xOffset, 0)];
// Update Navigation Page Control
[self.navigationPageControl setNumberOfPages:[self.navigationItemsViews count]];
[self.navigationPageControl setCurrentPage:self.currentIndex];
CGSize viewSize = [self.navigationPageControl sizeForNumberOfPages:[self.navigationItemsViews count]];
CGFloat originX = (distance - viewSize.width/2);
[self.navigationPageControl setFrame:(CGRect){originX, 34, viewSize.width, viewSize.height}];
}
-(void)setAlphaWithOffset:(UIAccelerationValue)xOffset
{
CGFloat distance = [self getDistanceValue];
[self.navigationItemsViews enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
int index = (int)idx;
CGFloat alpha = xOffset < distance * index ? (xOffset - distance * (index - 1)) / distance : 1 - ((xOffset - distance * index) / distance);
[obj setAlpha:alpha];
}];
}
-(UILabel *)createNewLabelWithText:(NSString *)text
{
UILabel *navTitleLabel = [UILabel new];
navTitleLabel.text = text;
navTitleLabel.font = [UIFont fontWithName:@"Helvetica" size:18];
navTitleLabel.textColor = [UIColor whiteColor];
navTitleLabel.alpha = 0;
return navTitleLabel;
}
-(CGSize)getLabelSize:(UILabel *)label
{
return [[label text] sizeWithAttributes:@{NSFontAttributeName:[label font]}];;
}
-(CGFloat)getDistanceValue
{
CGPoint middle = [self.navigationController.navigationBar convertPoint:self.navigationController.navigationBar.center toView:self.navigationView];
return middle.x ;
}
@end

View File

@ -2,7 +2,7 @@
// XLBarView.h
// XLPagerTabStrip ( https://github.com/xmartlabs/XLPagerTabStrip )
//
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy

View File

@ -2,7 +2,7 @@
// XLBarView.m
// XLPagerTabStrip ( https://github.com/xmartlabs/XLPagerTabStrip )
//
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy

View File

@ -2,7 +2,7 @@
// XLButtonBarView.h
// XLPagerTabStrip ( https://github.com/xmartlabs/XLPagerTabStrip )
//
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy

View File

@ -2,7 +2,7 @@
// XLButtonBarView.m
// XLPagerTabStrip ( https://github.com/xmartlabs/XLPagerTabStrip )
//
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy

View File

@ -2,7 +2,7 @@
// XLButtonBarViewCell.h
// XLPagerTabStrip ( https://github.com/xmartlabs/XLPagerTabStrip )
//
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy

View File

@ -2,7 +2,7 @@
// XLButtonBarViewCell.m
// XLPagerTabStrip ( https://github.com/xmartlabs/XLPagerTabStrip )
//
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy

View File

@ -2,7 +2,7 @@
// main.m
// XLPagerTabStrip ( https://github.com/xmartlabs/XLPagerTabStrip )
//
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy

View File

@ -2,7 +2,7 @@
// XLPagerTabStripTests.m
// XLPagerTabStrip ( https://github.com/xmartlabs/XLPagerTabStrip )
//
// Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com )
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy