rename types to make them shorter
This commit is contained in:
parent
0811a95ada
commit
8784865790
|
|
@ -41,9 +41,9 @@ class BarExampleViewController: BarPagerTabStripViewController {
|
|||
super.viewDidLoad()
|
||||
}
|
||||
|
||||
// MARK: - PagerTabStripViewControllerDataSource
|
||||
// MARK: - PagerTabStripDataSource
|
||||
|
||||
override func viewControllersForPagerTabStripViewController(pagerTabStripController: PagerTabStripViewController) -> [UIViewController] {
|
||||
override func viewControllersForPagerTabStrip(pagerTabStripController: PagerTabStripViewController) -> [UIViewController] {
|
||||
|
||||
let child_1 = TableChildExampleViewController(style: .Plain, itemInfo: "Table View")
|
||||
let child_2 = ChildExampleViewController(itemInfo: "View")
|
||||
|
|
|
|||
|
|
@ -36,9 +36,9 @@ class ButtonBarExampleViewController: ButtonBarPagerTabStripViewController {
|
|||
buttonBarView.backgroundColor = UIColor(red: 7/255, green: 185/255, blue: 155/255, alpha: 1)
|
||||
}
|
||||
|
||||
// MARK: - PagerTabStripVIewControllerDataSource
|
||||
// MARK: - PagerTabStripDataSource
|
||||
|
||||
override func viewControllersForPagerTabStripViewController(pagerTabStripController: PagerTabStripViewController) -> [UIViewController] {
|
||||
override func viewControllersForPagerTabStrip(pagerTabStripController: PagerTabStripViewController) -> [UIViewController] {
|
||||
let child_1 = TableChildExampleViewController(style: .Plain, itemInfo: "Table View")
|
||||
let child_2 = ChildExampleViewController(itemInfo: "View")
|
||||
let child_3 = TableChildExampleViewController(style: .Grouped, itemInfo: "Table View 2")
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ class ChildExampleViewController: UIViewController, IndicatorInfoProvider {
|
|||
|
||||
// MARK: - IndicatorInfoProvider
|
||||
|
||||
func infoForPagerTabStripViewController(pagerTabStripController: PagerTabStripViewController) -> IndicatorInfo {
|
||||
func indicatorInfoForPagerTabStrip(pagerTabStripController: PagerTabStripViewController) -> IndicatorInfo {
|
||||
return itemInfo
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ class TableChildExampleViewController: UITableViewController, IndicatorInfoProvi
|
|||
|
||||
// MARK: - IndicatorInfoProvider
|
||||
|
||||
func infoForPagerTabStripViewController(pagerTabStripController: PagerTabStripViewController) -> IndicatorInfo {
|
||||
func indicatorInfoForPagerTabStrip(pagerTabStripController: PagerTabStripViewController) -> IndicatorInfo {
|
||||
return itemInfo
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,9 +52,9 @@ class InstagramExampleViewController: ButtonBarPagerTabStripViewController {
|
|||
super.viewDidLoad()
|
||||
}
|
||||
|
||||
// MARK: - PagerTabStripVIewControllerDataSource
|
||||
// MARK: - PagerTabStripDataSource
|
||||
|
||||
override func viewControllersForPagerTabStripViewController(pagerTabStripController: PagerTabStripViewController) -> [UIViewController] {
|
||||
override func viewControllersForPagerTabStrip(pagerTabStripController: PagerTabStripViewController) -> [UIViewController] {
|
||||
let child_1 = TableChildExampleViewController(style: .Plain, itemInfo: "FOLLOWING")
|
||||
let child_2 = ChildExampleViewController(itemInfo: "YOU")
|
||||
return [child_1, child_2]
|
||||
|
|
|
|||
|
|
@ -57,9 +57,9 @@ class NavButtonBarExampleViewController: ButtonBarPagerTabStripViewController {
|
|||
}
|
||||
}
|
||||
|
||||
// MARK: - PagerTabStripViewControllerDataSource
|
||||
// MARK: - PagerTabStripDataSource
|
||||
|
||||
override func viewControllersForPagerTabStripViewController(pagerTabStripController: PagerTabStripViewController) -> [UIViewController] {
|
||||
override func viewControllersForPagerTabStrip(pagerTabStripController: PagerTabStripViewController) -> [UIViewController] {
|
||||
let child_1 = TableChildExampleViewController(style: .Plain, itemInfo: "Table View")
|
||||
let child_2 = ChildExampleViewController(itemInfo: "View")
|
||||
let child_3 = TableChildExampleViewController(style: .Grouped, itemInfo: "Table View 2")
|
||||
|
|
|
|||
|
|
@ -35,9 +35,9 @@ class SegmentedExampleViewController: SegmentedPagerTabStripViewController {
|
|||
settings.style.segmentedControlColor = .whiteColor()
|
||||
}
|
||||
|
||||
// MARK: - PagerTabStripViewControllerDataSource
|
||||
// MARK: - PagerTabStripDataSource
|
||||
|
||||
override func viewControllersForPagerTabStripViewController(pagerTabStripController: PagerTabStripViewController) -> [UIViewController] {
|
||||
override func viewControllersForPagerTabStrip(pagerTabStripController: PagerTabStripViewController) -> [UIViewController] {
|
||||
let child_1 = TableChildExampleViewController(style: .Plain, itemInfo: "Table View")
|
||||
let child_2 = ChildExampleViewController(itemInfo: "View")
|
||||
let child_3 = TableChildExampleViewController(style: .Grouped, itemInfo: "Table View 2")
|
||||
|
|
|
|||
|
|
@ -55,9 +55,9 @@ public class SpotifyExampleViewController: ButtonBarPagerTabStripViewController
|
|||
super.viewDidLoad()
|
||||
}
|
||||
|
||||
// MARK: - PagerTabStripVIewControllerDataSource
|
||||
// MARK: - PagerTabStripDataSource
|
||||
|
||||
public override func viewControllersForPagerTabStripViewController(pagerTabStripController: PagerTabStripViewController) -> [UIViewController] {
|
||||
public override func viewControllersForPagerTabStrip(pagerTabStripController: PagerTabStripViewController) -> [UIViewController] {
|
||||
let child_1 = TableChildExampleViewController(style: .Plain, itemInfo: IndicatorInfo(title: "FRIENDS"))
|
||||
child_1.blackTheme = true
|
||||
let child_2 = TableChildExampleViewController(style: .Plain, itemInfo: IndicatorInfo(title: "FEATURED"))
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ import XLPagerTabStrip
|
|||
class TwitterExampleViewController: TwitterPagerTabStripViewController {
|
||||
var isReload = false
|
||||
|
||||
override func viewControllersForPagerTabStripViewController(pagerTabStripController: PagerTabStripViewController) -> [UIViewController] {
|
||||
override func viewControllersForPagerTabStrip(pagerTabStripController: PagerTabStripViewController) -> [UIViewController] {
|
||||
|
||||
let child_1 = TableChildExampleViewController(style: .Plain, itemInfo: "TableView")
|
||||
let child_2 = ChildExampleViewController(itemInfo: "View")
|
||||
|
|
|
|||
|
|
@ -70,9 +70,9 @@ class YoutubeExampleViewController: BaseButtonBarPagerTabStripViewController<You
|
|||
navigationController?.navigationBar.setBackgroundImage(UIImage(), forBarMetrics: .Default)
|
||||
}
|
||||
|
||||
// MARK: - PagerTabStripVIewControllerDataSource
|
||||
// MARK: - PagerTabStripDataSource
|
||||
|
||||
override func viewControllersForPagerTabStripViewController(pagerTabStripController: PagerTabStripViewController) -> [UIViewController] {
|
||||
override func viewControllersForPagerTabStrip(pagerTabStripController: PagerTabStripViewController) -> [UIViewController] {
|
||||
let child_1 = TableChildExampleViewController(style: .Plain, itemInfo: IndicatorInfo(title: " HOME", image: UIImage(named: "home")))
|
||||
let child_2 = TableChildExampleViewController(style: .Plain, itemInfo: IndicatorInfo(title: " TRENDING", image: UIImage(named: "trending")))
|
||||
let child_3 = ChildExampleViewController(itemInfo: IndicatorInfo(title: " ACCOUNT", image: UIImage(named: "profile")))
|
||||
|
|
@ -91,7 +91,7 @@ class YoutubeExampleViewController: BaseButtonBarPagerTabStripViewController<You
|
|||
let child = viewControllers[toIndex] as! IndicatorInfoProvider
|
||||
UIView.performWithoutAnimation({ [weak self] () -> Void in
|
||||
guard let me = self else { return }
|
||||
me.navigationItem.leftBarButtonItem?.title = child.infoForPagerTabStripViewController(me).title
|
||||
me.navigationItem.leftBarButtonItem?.title = child.indicatorInfoForPagerTabStrip(me).title
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
|||
39
README.md
39
README.md
|
|
@ -48,7 +48,7 @@ Long time ago twitter app made use of this type of pager in the app main screen.
|
|||
|
||||
### Segmented
|
||||
|
||||
This mode uses a `UIsegmentedControl` to indicates which is the view controller being displayed.
|
||||
This mode uses a `UISegmentedControl` to indicates which is the view controller being displayed.
|
||||
|
||||
<img src="Example/segmented.gif" width="250"/>
|
||||
|
||||
|
|
@ -83,34 +83,34 @@ Drag a `UIScrollView` into your view controller view and connect `PagerTabStripV
|
|||
|
||||
Depending on which type of paging view controller you are working with you may have to connect more outlets.
|
||||
|
||||
For `BarPagerTabStripViewController` we should connect `barView` outlet. `ButtonBarPagerTabStripViewController` requires us to connect `buttonBarView` outlet. `SegmentedPagerTabStripViewController` has a `segmentedControl` outlet, if the outlet is not connected the library try to set up the navigationItem titleView using a `UIsegmentedControl`. `TwitterPagerTabStripViewController` doesn't require to connect any additional outlet.
|
||||
For `BarPagerTabStripViewController` we should connect `barView` outlet. `ButtonBarPagerTabStripViewController` requires us to connect `buttonBarView` outlet. `SegmentedPagerTabStripViewController` has a `segmentedControl` outlet, if the outlet is not connected the library try to set up the navigationItem `titleView` property using a `UISegmentedControl`. `TwitterPagerTabStripViewController` doesn't require us to connect any additional outlet.
|
||||
|
||||
> The example project contains a example for each pager controller type and we can look into it to see how views were added and how outlets were connected.
|
||||
|
||||
##### Provide the view controllers that will appear embedded into the PagerTabStrip view controller
|
||||
|
||||
You can provide the view controllers by overriding `func viewControllersForPagerTabStripViewController(pagerTabStripController: PagerTabStripViewController) -> [UIViewController]` method.
|
||||
You can provide the view controllers by overriding `func viewControllersForPagerTabStrip(pagerTabStripController: PagerTabStripViewController) -> [UIViewController]` method.
|
||||
|
||||
```swift
|
||||
override public func viewControllersForPagerTabStripViewController(pagerTabStripController: PagerTabStripViewController) -> [UIViewController] {
|
||||
override public func viewControllersForPagerTabStrip(pagerTabStripController: PagerTabStripViewController) -> [UIViewController] {
|
||||
return [MyEmbeddedViewController(), MySecondEmbeddedViewController()]
|
||||
}
|
||||
```
|
||||
|
||||
> The method above is the only method declared in `PagerTabStripViewControllerDataSource` protocol. We don't need to explicitly conform to it since base pager class already does it.
|
||||
> The method above is the only method declared in `PagerTabStripDataSource` protocol. We don't need to explicitly conform to it since base pager class already does it.
|
||||
|
||||
|
||||
##### Provide information to show in each indicator
|
||||
|
||||
Every UIViewController that will appear within the PagerTabStrip controller needs to provide either a title or an image.
|
||||
In order to do so they should conform to `PagerTabStripChildItem` by implementing `func childHeaderForPagerTabStripViewController(pagerTabStripController: PagerTabStripViewController) -> ChildItemInfo`
|
||||
Every UIViewController that will appear within the PagerTabStrip needs to provide either a title or an image.
|
||||
In order to do so they should conform to `IndicatorInfoProvider` by implementing `func indicatorInfoForPagerTabStrip(pagerTabStripController: PagerTabStripViewController) -> IndicatorInfo`
|
||||
which provides the information required to show the PagerTabStrip menu (indicator) associated with the view controller.
|
||||
|
||||
```swift
|
||||
class MyEmbeddedViewController: UITableViewController, PagerTabStripChildItem {
|
||||
class MyEmbeddedViewController: UITableViewController, IndicatorInfoProvider {
|
||||
|
||||
func childInfoForPagerTabStripViewController(pagerTabStripController: PagerTabStripViewController) -> ChildItemInfo {
|
||||
return ChildItemInfo(title: "My Child title")
|
||||
func indicatorInfoForPagerTabStrip(pagerTabStripController: PagerTabStripViewController) -> IndicatorInfo {
|
||||
return IndicatorInfo(title: "My Child title")
|
||||
}
|
||||
}
|
||||
```
|
||||
|
|
@ -121,7 +121,6 @@ That's it! We're done! 🍻🍻
|
|||
## Customization
|
||||
|
||||
|
||||
|
||||
## Requirements
|
||||
|
||||
* iOS 8.0+
|
||||
|
|
@ -145,7 +144,7 @@ You can also experiment and learn with the *XLPagerTabStrip Playground* which is
|
|||
|
||||
## Installation
|
||||
|
||||
#### CocoaPods
|
||||
### CocoaPods
|
||||
|
||||
[CocoaPods](https://cocoapods.org/) is a dependency manager for Cocoa projects.
|
||||
|
||||
|
|
@ -155,7 +154,7 @@ To install XLPagerTabStrip, simply add the following line to your Podfile:
|
|||
pod 'XLPagerTabStrip', '~> 4.0'
|
||||
```
|
||||
|
||||
#### Carthage
|
||||
### Carthage
|
||||
|
||||
[Carthage](https://github.com/Carthage/Carthage) is a simple, decentralized dependency manager for Cocoa.
|
||||
|
||||
|
|
@ -165,6 +164,20 @@ To install XLPagerTabStrip, simply add the following line to your Cartfile:
|
|||
github "xmartlabs/XLPagerTabStrip" ~> 4.0
|
||||
```
|
||||
|
||||
## FAQ
|
||||
|
||||
#### How to change the visible child view controller programmatically
|
||||
|
||||
`XLPagerTabStripViewController` provides the following methods to programmatically change the visible child view controller:
|
||||
|
||||
```swift
|
||||
func moveToViewControllerAtIndex(index: Int)
|
||||
func moveToViewControllerAtIndex(index: Int, animated: Bool)
|
||||
func moveToViewController(viewController: UIViewController)
|
||||
func moveToViewController(viewController: UIViewController, animated: Bool)
|
||||
```
|
||||
|
||||
|
||||
## Author
|
||||
|
||||
* [Martin Barreto](https://github.com/mtnBarreto) ([@mtnBarreto](https://twitter.com/mtnBarreto))
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ public struct BarPagerTabStripSettings {
|
|||
public var style = Style()
|
||||
}
|
||||
|
||||
public class BarPagerTabStripViewController: PagerTabStripViewController, PagerTabStripViewControllerDataSource, PagerTabStripViewControllerIsProgressiveDelegate {
|
||||
public class BarPagerTabStripViewController: PagerTabStripViewController, PagerTabStripDataSource, PagerTabStripIsProgressiveDelegate {
|
||||
|
||||
public var settings = BarPagerTabStripSettings()
|
||||
|
||||
|
|
@ -82,7 +82,7 @@ public class BarPagerTabStripViewController: PagerTabStripViewController, PagerT
|
|||
}
|
||||
}
|
||||
|
||||
// MARK: - PagerTabStripViewControllerDelegate
|
||||
// MARK: - PagerTabStripDelegate
|
||||
|
||||
public func pagerTabStripViewController(pagerTabStripViewController: PagerTabStripViewController, updateIndicatorFromIndex fromIndex: Int, toIndex: Int) throws {
|
||||
barView.moveToIndex(index: toIndex, animated: true)
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
import Foundation
|
||||
|
||||
public class BaseButtonBarPagerTabStripViewController<ButtonBarCellType : UICollectionViewCell>: PagerTabStripViewController, PagerTabStripViewControllerDataSource, PagerTabStripViewControllerIsProgressiveDelegate, UICollectionViewDelegate, UICollectionViewDataSource {
|
||||
public class BaseButtonBarPagerTabStripViewController<ButtonBarCellType : UICollectionViewCell>: PagerTabStripViewController, PagerTabStripDataSource, PagerTabStripIsProgressiveDelegate, UICollectionViewDelegate, UICollectionViewDataSource {
|
||||
|
||||
public var settings = ButtonBarPagerTabStripSettings()
|
||||
public var buttonBarItemSpec: ButtonBarItemSpec<ButtonBarCellType>!
|
||||
|
|
@ -231,7 +231,7 @@ public class BaseButtonBarPagerTabStripViewController<ButtonBarCellType : UIColl
|
|||
fatalError("UICollectionViewCell should be or extend from ButtonBarViewCell")
|
||||
}
|
||||
let childController = viewControllers[indexPath.item] as! IndicatorInfoProvider
|
||||
let indicatorInfo = childController.infoForPagerTabStripViewController(self)
|
||||
let indicatorInfo = childController.indicatorInfoForPagerTabStrip(self)
|
||||
|
||||
configureCell(cell, indicatorInfo: indicatorInfo)
|
||||
|
||||
|
|
@ -271,7 +271,7 @@ public class BaseButtonBarPagerTabStripViewController<ButtonBarCellType : UIColl
|
|||
|
||||
for viewController in self.viewControllers {
|
||||
let childController = viewController as! IndicatorInfoProvider
|
||||
let indicatorInfo = childController.infoForPagerTabStripViewController(self)
|
||||
let indicatorInfo = childController.indicatorInfoForPagerTabStrip(self)
|
||||
switch buttonBarItemSpec! {
|
||||
case .CellClass(let widthCallback):
|
||||
let width = widthCallback(indicatorInfo)
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ public struct ButtonBarPagerTabStripSettings {
|
|||
public var style = Style()
|
||||
}
|
||||
|
||||
public class ButtonBarPagerTabStripViewController: PagerTabStripViewController, PagerTabStripViewControllerDataSource, PagerTabStripViewControllerIsProgressiveDelegate, UICollectionViewDelegate, UICollectionViewDataSource {
|
||||
public class ButtonBarPagerTabStripViewController: PagerTabStripViewController, PagerTabStripDataSource, PagerTabStripIsProgressiveDelegate, UICollectionViewDelegate, UICollectionViewDataSource {
|
||||
|
||||
public var settings = ButtonBarPagerTabStripSettings()
|
||||
|
||||
|
|
@ -266,7 +266,7 @@ public class ButtonBarPagerTabStripViewController: PagerTabStripViewController,
|
|||
fatalError("UICollectionViewCell should be or extend from ButtonBarViewCell")
|
||||
}
|
||||
let childController = viewControllers[indexPath.item] as! IndicatorInfoProvider
|
||||
let indicatorInfo = childController.infoForPagerTabStripViewController(self)
|
||||
let indicatorInfo = childController.indicatorInfoForPagerTabStrip(self)
|
||||
|
||||
cell.label.text = indicatorInfo.title
|
||||
cell.label.font = settings.style.buttonBarItemFont ?? cell.label.font
|
||||
|
|
@ -316,7 +316,7 @@ public class ButtonBarPagerTabStripViewController: PagerTabStripViewController,
|
|||
|
||||
for viewController in self.viewControllers {
|
||||
let childController = viewController as! IndicatorInfoProvider
|
||||
let indicatorInfo = childController.infoForPagerTabStripViewController(self)
|
||||
let indicatorInfo = childController.indicatorInfoForPagerTabStrip(self)
|
||||
switch buttonBarItemSpec {
|
||||
case .CellClass(let widthCallback):
|
||||
let width = widthCallback(indicatorInfo)
|
||||
|
|
|
|||
|
|
@ -30,22 +30,22 @@ import Foundation
|
|||
|
||||
public protocol IndicatorInfoProvider {
|
||||
|
||||
func infoForPagerTabStripViewController(pagerTabStripController: PagerTabStripViewController) -> IndicatorInfo
|
||||
func indicatorInfoForPagerTabStrip(pagerTabStripController: PagerTabStripViewController) -> IndicatorInfo
|
||||
}
|
||||
|
||||
public protocol PagerTabStripViewControllerDelegate: class {
|
||||
public protocol PagerTabStripDelegate: class {
|
||||
|
||||
func pagerTabStripViewController(pagerTabStripViewController: PagerTabStripViewController, updateIndicatorFromIndex fromIndex: Int, toIndex: Int) throws
|
||||
}
|
||||
|
||||
public protocol PagerTabStripViewControllerIsProgressiveDelegate : PagerTabStripViewControllerDelegate {
|
||||
public protocol PagerTabStripIsProgressiveDelegate : PagerTabStripDelegate {
|
||||
|
||||
func pagerTabStripViewController(pagerTabStripViewController: PagerTabStripViewController, updateIndicatorFromIndex fromIndex: Int, toIndex: Int, withProgressPercentage progressPercentage: CGFloat, indexWasChanged: Bool) throws
|
||||
}
|
||||
|
||||
public protocol PagerTabStripViewControllerDataSource: class {
|
||||
public protocol PagerTabStripDataSource: class {
|
||||
|
||||
func viewControllersForPagerTabStripViewController(pagerTabStripController: PagerTabStripViewController) -> [UIViewController]
|
||||
func viewControllersForPagerTabStrip(pagerTabStripController: PagerTabStripViewController) -> [UIViewController]
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -59,8 +59,8 @@ public class PagerTabStripViewController: UIViewController, UIScrollViewDelegate
|
|||
return containerView
|
||||
}()
|
||||
|
||||
public weak var delegate: PagerTabStripViewControllerDelegate?
|
||||
public weak var datasource: PagerTabStripViewControllerDataSource?
|
||||
public weak var delegate: PagerTabStripDelegate?
|
||||
public weak var datasource: PagerTabStripDataSource?
|
||||
|
||||
public var pagerBehaviour = PagerTabStripBehaviour.Progressive(skipIntermediteViewControllers: true, elasticIndicatorLimit: true)
|
||||
|
||||
|
|
@ -156,10 +156,10 @@ public class PagerTabStripViewController: UIViewController, UIScrollViewDelegate
|
|||
moveToViewControllerAtIndex(viewControllers.indexOf(viewController)!, animated: animated)
|
||||
}
|
||||
|
||||
//MARK: - PagerTabStripViewControllerDataSource
|
||||
//MARK: - PagerTabStripDataSource
|
||||
|
||||
public func viewControllersForPagerTabStripViewController(pagerTabStripController: PagerTabStripViewController) -> [UIViewController] {
|
||||
assertionFailure("Sub-class must implement the PagerTabStripViewControllerDataSource viewControllersForPagerTabStripViewController: method")
|
||||
public func viewControllersForPagerTabStrip(pagerTabStripController: PagerTabStripViewController) -> [UIViewController] {
|
||||
assertionFailure("Sub-class must implement the PagerTabStripDataSource viewControllersForPagerTabStrip: method")
|
||||
return []
|
||||
}
|
||||
|
||||
|
|
@ -253,7 +253,7 @@ public class PagerTabStripViewController: UIViewController, UIScrollViewDelegate
|
|||
currentIndex = newCurrentIndex
|
||||
let changeCurrentIndex = newCurrentIndex != oldCurrentIndex
|
||||
|
||||
if let progressiveDeledate = self as? PagerTabStripViewControllerIsProgressiveDelegate where pagerBehaviour.isProgressiveIndicator {
|
||||
if let progressiveDeledate = self as? PagerTabStripIsProgressiveDelegate where pagerBehaviour.isProgressiveIndicator {
|
||||
|
||||
let (fromIndex, toIndex, scrollPercentage) = progressiveIndicatorData(virtualPage)
|
||||
try! progressiveDeledate.pagerTabStripViewController(self, updateIndicatorFromIndex: fromIndex, toIndex: toIndex, withProgressPercentage: scrollPercentage, indexWasChanged: changeCurrentIndex)
|
||||
|
|
@ -363,12 +363,12 @@ public class PagerTabStripViewController: UIViewController, UIScrollViewDelegate
|
|||
guard let dataSource = datasource else {
|
||||
fatalError("dataSource must not be nil")
|
||||
}
|
||||
viewControllers = dataSource.viewControllersForPagerTabStripViewController(self)
|
||||
viewControllers = dataSource.viewControllersForPagerTabStrip(self)
|
||||
// viewControllers
|
||||
guard viewControllers.count != 0 else {
|
||||
fatalError("viewControllersForPagerTabStripViewController should provide at least one child view controller")
|
||||
fatalError("viewControllersForPagerTabStrip should provide at least one child view controller")
|
||||
}
|
||||
viewControllers.forEach { if !($0 is IndicatorInfoProvider) { fatalError("Every view controller provided by PagerTabStripViewControllerDataSource's viewControllersForPagerTabStripViewController method must conform to InfoProvider") }}
|
||||
viewControllers.forEach { if !($0 is IndicatorInfoProvider) { fatalError("Every view controller provided by PagerTabStripDataSource's viewControllersForPagerTabStrip method must conform to InfoProvider") }}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ public struct SegmentedPagerTabStripSettings {
|
|||
}
|
||||
|
||||
|
||||
public class SegmentedPagerTabStripViewController: PagerTabStripViewController, PagerTabStripViewControllerDataSource, PagerTabStripViewControllerDelegate {
|
||||
public class SegmentedPagerTabStripViewController: PagerTabStripViewController, PagerTabStripDataSource, PagerTabStripDelegate {
|
||||
|
||||
@IBOutlet lazy public var segmentedControl: UISegmentedControl! = UISegmentedControl()
|
||||
|
||||
|
|
@ -75,11 +75,11 @@ public class SegmentedPagerTabStripViewController: PagerTabStripViewController,
|
|||
segmentedControl.removeAllSegments()
|
||||
for (index, item) in viewControllers.enumerate(){
|
||||
let child = item as! IndicatorInfoProvider
|
||||
if let image = child.infoForPagerTabStripViewController(self).image {
|
||||
if let image = child.indicatorInfoForPagerTabStrip(self).image {
|
||||
segmentedControl.insertSegmentWithImage(image, atIndex: index, animated: false)
|
||||
}
|
||||
else {
|
||||
segmentedControl.insertSegmentWithTitle(child.infoForPagerTabStripViewController(self).title, atIndex: index, animated: false)
|
||||
segmentedControl.insertSegmentWithTitle(child.indicatorInfoForPagerTabStrip(self).title, atIndex: index, animated: false)
|
||||
}
|
||||
}
|
||||
segmentedControl.selectedSegmentIndex = currentIndex
|
||||
|
|
@ -92,7 +92,7 @@ public class SegmentedPagerTabStripViewController: PagerTabStripViewController,
|
|||
moveToViewControllerAtIndex(index)
|
||||
}
|
||||
|
||||
// MARK: - PagerTabStripViewControllerDelegate
|
||||
// MARK: - PagerTabStripDelegate
|
||||
|
||||
public func pagerTabStripViewController(pagerTabStripViewController: PagerTabStripViewController, updateIndicatorFromIndex fromIndex: Int, toIndex: Int) throws {
|
||||
if shouldUpdateSegmentedControl {
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ public struct TwitterPagerTabStripSettings {
|
|||
public var style = Style()
|
||||
}
|
||||
|
||||
public class TwitterPagerTabStripViewController: PagerTabStripViewController, PagerTabStripViewControllerDataSource, PagerTabStripViewControllerIsProgressiveDelegate {
|
||||
public class TwitterPagerTabStripViewController: PagerTabStripViewController, PagerTabStripDataSource, PagerTabStripIsProgressiveDelegate {
|
||||
|
||||
public var settings = TwitterPagerTabStripSettings()
|
||||
|
||||
|
|
@ -74,7 +74,7 @@ public class TwitterPagerTabStripViewController: PagerTabStripViewController, Pa
|
|||
setNavigationViewItemsPosition(updateAlpha: true)
|
||||
}
|
||||
|
||||
// MARK: - PagerTabStripViewControllerDelegate
|
||||
// MARK: - PagerTabStripDelegate
|
||||
|
||||
public func pagerTabStripViewController(pagerTabStripViewController: PagerTabStripViewController, updateIndicatorFromIndex fromIndex: Int, toIndex: Int) throws {
|
||||
fatalError()
|
||||
|
|
@ -165,7 +165,7 @@ public class TwitterPagerTabStripViewController: PagerTabStripViewController, Pa
|
|||
childTitleLabels.removeAll()
|
||||
for (index, item) in viewControllers.enumerate() {
|
||||
let child = item as! IndicatorInfoProvider
|
||||
let indicatorInfo = child.infoForPagerTabStripViewController(self)
|
||||
let indicatorInfo = child.indicatorInfoForPagerTabStrip(self)
|
||||
let navTitleLabel : UILabel = {
|
||||
let label = UILabel()
|
||||
label.text = indicatorInfo.title
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
281BFDC11C511C420090C26F /* ChildItemInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 281BFDC01C511C420090C26F /* ChildItemInfo.swift */; };
|
||||
281BFDC11C511C420090C26F /* IndicatorInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 281BFDC01C511C420090C26F /* IndicatorInfo.swift */; };
|
||||
281BFDC31C511F120090C26F /* PagerTabStripBehaviour.swift in Sources */ = {isa = PBXBuildFile; fileRef = 281BFDC21C511F120090C26F /* PagerTabStripBehaviour.swift */; };
|
||||
287D0A6E1C4B73BD004566D6 /* XLPagerTabStripTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 287D0A6D1C4B73BD004566D6 /* XLPagerTabStripTests.swift */; };
|
||||
28C83C841C54229A000B2902 /* BaseButtonBarPagerTabStripViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28C83C831C54229A000B2902 /* BaseButtonBarPagerTabStripViewController.swift */; };
|
||||
|
|
@ -39,7 +39,7 @@
|
|||
/* End PBXContainerItemProxy section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
281BFDC01C511C420090C26F /* ChildItemInfo.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ChildItemInfo.swift; sourceTree = "<group>"; };
|
||||
281BFDC01C511C420090C26F /* IndicatorInfo.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IndicatorInfo.swift; sourceTree = "<group>"; };
|
||||
281BFDC21C511F120090C26F /* PagerTabStripBehaviour.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PagerTabStripBehaviour.swift; sourceTree = "<group>"; };
|
||||
287D0A6D1C4B73BD004566D6 /* XLPagerTabStripTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = XLPagerTabStripTests.swift; path = Tests/XLPagerTabStripTests.swift; sourceTree = SOURCE_ROOT; };
|
||||
28C83C831C54229A000B2902 /* BaseButtonBarPagerTabStripViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BaseButtonBarPagerTabStripViewController.swift; sourceTree = "<group>"; };
|
||||
|
|
@ -154,7 +154,7 @@
|
|||
281BFDBE1C511B890090C26F /* Views */,
|
||||
28E098BD1C5002D90083B788 /* PagerTabStripError.swift */,
|
||||
28E098BF1C5003130083B788 /* SwipeDirection.swift */,
|
||||
281BFDC01C511C420090C26F /* ChildItemInfo.swift */,
|
||||
281BFDC01C511C420090C26F /* IndicatorInfo.swift */,
|
||||
281BFDC21C511F120090C26F /* PagerTabStripBehaviour.swift */,
|
||||
);
|
||||
path = Sources;
|
||||
|
|
@ -287,7 +287,7 @@
|
|||
CBA0A1FC1C502DA300C5748C /* BarPagerTabStripViewController.swift in Sources */,
|
||||
CB71C6EE1C4EB988008EC806 /* SegmentedPagerTabStripViewController.swift in Sources */,
|
||||
28E098BE1C5002D90083B788 /* PagerTabStripError.swift in Sources */,
|
||||
281BFDC11C511C420090C26F /* ChildItemInfo.swift in Sources */,
|
||||
281BFDC11C511C420090C26F /* IndicatorInfo.swift in Sources */,
|
||||
CB86ED6B1C4D6E6C00DA463B /* PagerTabStripViewController.swift in Sources */,
|
||||
28E098C01C5003130083B788 /* SwipeDirection.swift in Sources */,
|
||||
CB0986C81C5158A000DF7087 /* ButtonBarViewCell.swift in Sources */,
|
||||
|
|
|
|||
Loading…
Reference in New Issue