Merge pull request #238 from xmartlabs/fix/carthageLinkingError
Fix/carthage linking error
This commit is contained in:
commit
d12b4fa6c5
|
|
@ -1,5 +1,15 @@
|
|||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "20x20",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "20x20",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "29x29",
|
||||
|
|
|
|||
|
|
@ -25,14 +25,14 @@
|
|||
import Foundation
|
||||
import XLPagerTabStrip
|
||||
|
||||
open class SpotifyExampleViewController: ButtonBarPagerTabStripViewController {
|
||||
class SpotifyExampleViewController: ButtonBarPagerTabStripViewController {
|
||||
|
||||
@IBOutlet weak var shadowView: UIView!
|
||||
|
||||
let graySpotifyColor = UIColor(red: 21/255.0, green: 21/255.0, blue: 24/255.0, alpha: 1.0)
|
||||
let darkGraySpotifyColor = UIColor(red: 19/255.0, green: 20/255.0, blue: 20/255.0, alpha: 1.0)
|
||||
|
||||
open override func viewDidLoad() {
|
||||
override func viewDidLoad() {
|
||||
// change selected bar color
|
||||
settings.style.buttonBarBackgroundColor = graySpotifyColor
|
||||
settings.style.buttonBarItemBackgroundColor = graySpotifyColor
|
||||
|
|
@ -56,7 +56,7 @@ open class SpotifyExampleViewController: ButtonBarPagerTabStripViewController {
|
|||
|
||||
// MARK: - PagerTabStripDataSource
|
||||
|
||||
open override func viewControllers(for pagerTabStripController: PagerTabStripViewController) -> [UIViewController] {
|
||||
override func viewControllers(for 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"))
|
||||
|
|
|
|||
|
|
@ -38,15 +38,15 @@ public struct BarPagerTabStripSettings {
|
|||
|
||||
open class BarPagerTabStripViewController: PagerTabStripViewController, PagerTabStripDataSource, PagerTabStripIsProgressiveDelegate {
|
||||
|
||||
open var settings = BarPagerTabStripSettings()
|
||||
public var settings = BarPagerTabStripSettings()
|
||||
|
||||
@IBOutlet lazy open var barView: BarView! = { [unowned self] in
|
||||
let barView = BarView(frame: CGRect(x: 0, y: 0, width: self.view.frame.size.width, height: self.settings.style.barHeight))
|
||||
barView.autoresizingMask = .flexibleWidth
|
||||
barView.backgroundColor = .black
|
||||
barView.selectedBar.backgroundColor = .white
|
||||
return barView
|
||||
}()
|
||||
@IBOutlet weak public var barView: BarView!
|
||||
|
||||
required public init?(coder aDecoder: NSCoder) {
|
||||
super.init(coder: aDecoder)
|
||||
delegate = self
|
||||
datasource = self
|
||||
}
|
||||
|
||||
public override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
|
||||
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
|
||||
|
|
@ -56,14 +56,16 @@ open class BarPagerTabStripViewController: PagerTabStripViewController, PagerTab
|
|||
|
||||
open override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
barView.backgroundColor = self.settings.style.barBackgroundColor ?? barView.backgroundColor
|
||||
barView.selectedBar.backgroundColor = self.settings.style.selectedBarBackgroundColor ?? barView.selectedBar.backgroundColor
|
||||
}
|
||||
|
||||
required public init?(coder aDecoder: NSCoder) {
|
||||
super.init(coder: aDecoder)
|
||||
delegate = self
|
||||
datasource = self
|
||||
barView = barView ?? {
|
||||
let barView = BarView(frame: CGRect(x: 0, y: 0, width: view.frame.size.width, height: settings.style.barHeight))
|
||||
barView.autoresizingMask = .flexibleWidth
|
||||
barView.backgroundColor = .black
|
||||
barView.selectedBar.backgroundColor = .white
|
||||
return barView
|
||||
}()
|
||||
|
||||
barView.backgroundColor = settings.style.barBackgroundColor ?? barView.backgroundColor
|
||||
barView.selectedBar.backgroundColor = settings.style.selectedBarBackgroundColor ?? barView.selectedBar.backgroundColor
|
||||
}
|
||||
|
||||
open override func viewWillAppear(_ animated: Bool) {
|
||||
|
|
|
|||
|
|
@ -26,27 +26,13 @@ import Foundation
|
|||
|
||||
open class BaseButtonBarPagerTabStripViewController<ButtonBarCellType : UICollectionViewCell>: PagerTabStripViewController, PagerTabStripDataSource, PagerTabStripIsProgressiveDelegate, UICollectionViewDelegate, UICollectionViewDataSource {
|
||||
|
||||
open var settings = ButtonBarPagerTabStripSettings()
|
||||
open var buttonBarItemSpec: ButtonBarItemSpec<ButtonBarCellType>!
|
||||
open var changeCurrentIndex: ((_ oldCell: ButtonBarCellType?, _ newCell: ButtonBarCellType?, _ animated: Bool) -> Void)?
|
||||
open var changeCurrentIndexProgressive: ((_ oldCell: ButtonBarCellType?, _ newCell: ButtonBarCellType?, _ progressPercentage: CGFloat, _ changeCurrentIndex: Bool, _ animated: Bool) -> Void)?
|
||||
public var settings = ButtonBarPagerTabStripSettings()
|
||||
public var buttonBarItemSpec: ButtonBarItemSpec<ButtonBarCellType>!
|
||||
public var changeCurrentIndex: ((_ oldCell: ButtonBarCellType?, _ newCell: ButtonBarCellType?, _ animated: Bool) -> Void)?
|
||||
public var changeCurrentIndexProgressive: ((_ oldCell: ButtonBarCellType?, _ newCell: ButtonBarCellType?, _ progressPercentage: CGFloat, _ changeCurrentIndex: Bool, _ animated: Bool) -> Void)?
|
||||
|
||||
|
||||
@IBOutlet open lazy var buttonBarView: ButtonBarView! = { [unowned self] in
|
||||
var flowLayout = UICollectionViewFlowLayout()
|
||||
flowLayout.scrollDirection = .horizontal
|
||||
flowLayout.sectionInset = UIEdgeInsetsMake(0, self.settings.style.buttonBarLeftContentInset ?? 35, 0, self.settings.style.buttonBarRightContentInset ?? 35)
|
||||
let buttonBarHeight = self.settings.style.buttonBarHeight ?? 44
|
||||
let buttonBar = ButtonBarView(frame: CGRect(x: 0, y: 0, width: self.view.frame.size.width, height: buttonBarHeight), collectionViewLayout: flowLayout)
|
||||
buttonBar.backgroundColor = .orange
|
||||
buttonBar.selectedBar.backgroundColor = .black
|
||||
buttonBar.autoresizingMask = .flexibleWidth
|
||||
var newContainerViewFrame = self.containerView.frame
|
||||
newContainerViewFrame.origin.y = buttonBarHeight
|
||||
newContainerViewFrame.size.height = self.containerView.frame.size.height - (buttonBarHeight - self.containerView.frame.origin.y)
|
||||
self.containerView.frame = newContainerViewFrame
|
||||
return buttonBar
|
||||
}()
|
||||
@IBOutlet public weak var buttonBarView: ButtonBarView!
|
||||
|
||||
lazy private var cachedCellWidths: [CGFloat]? = { [unowned self] in
|
||||
return self.calculateWidths()
|
||||
|
|
@ -66,7 +52,21 @@ open class BaseButtonBarPagerTabStripViewController<ButtonBarCellType : UICollec
|
|||
|
||||
open override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
buttonBarView = buttonBarView ?? {
|
||||
let flowLayout = UICollectionViewFlowLayout()
|
||||
flowLayout.scrollDirection = .horizontal
|
||||
flowLayout.sectionInset = UIEdgeInsetsMake(0, settings.style.buttonBarLeftContentInset ?? 35, 0, settings.style.buttonBarRightContentInset ?? 35)
|
||||
let buttonBarHeight = settings.style.buttonBarHeight ?? 44
|
||||
let buttonBar = ButtonBarView(frame: CGRect(x: 0, y: 0, width: view.frame.size.width, height: buttonBarHeight), collectionViewLayout: flowLayout)
|
||||
buttonBar.backgroundColor = .orange
|
||||
buttonBar.selectedBar.backgroundColor = .black
|
||||
buttonBar.autoresizingMask = .flexibleWidth
|
||||
var newContainerViewFrame = containerView.frame
|
||||
newContainerViewFrame.origin.y = buttonBarHeight
|
||||
newContainerViewFrame.size.height = containerView.frame.size.height - (buttonBarHeight - containerView.frame.origin.y)
|
||||
containerView.frame = newContainerViewFrame
|
||||
return buttonBar
|
||||
}()
|
||||
if buttonBarView.superview == nil {
|
||||
view.addSubview(buttonBarView)
|
||||
}
|
||||
|
|
@ -82,7 +82,7 @@ open class BaseButtonBarPagerTabStripViewController<ButtonBarCellType : UICollec
|
|||
flowLayout.minimumInteritemSpacing = settings.style.buttonBarMinimumLineSpacing ?? flowLayout.minimumLineSpacing
|
||||
flowLayout.minimumLineSpacing = settings.style.buttonBarMinimumLineSpacing ?? flowLayout.minimumLineSpacing
|
||||
let sectionInset = flowLayout.sectionInset
|
||||
flowLayout.sectionInset = UIEdgeInsetsMake(sectionInset.top, self.settings.style.buttonBarLeftContentInset ?? sectionInset.left, sectionInset.bottom, self.settings.style.buttonBarRightContentInset ?? sectionInset.right)
|
||||
flowLayout.sectionInset = UIEdgeInsetsMake(sectionInset.top, settings.style.buttonBarLeftContentInset ?? sectionInset.left, sectionInset.bottom, settings.style.buttonBarRightContentInset ?? sectionInset.right)
|
||||
buttonBarView.showsHorizontalScrollIndicator = false
|
||||
buttonBarView.backgroundColor = settings.style.buttonBarBackgroundColor ?? buttonBarView.backgroundColor
|
||||
buttonBarView.selectedBar.backgroundColor = settings.style.selectedBarBackgroundColor
|
||||
|
|
@ -266,13 +266,13 @@ open class BaseButtonBarPagerTabStripViewController<ButtonBarCellType : UICollec
|
|||
}
|
||||
|
||||
private func calculateWidths() -> [CGFloat] {
|
||||
let flowLayout = self.buttonBarView.collectionViewLayout as! UICollectionViewFlowLayout
|
||||
let numberOfCells = self.viewControllers.count
|
||||
let flowLayout = buttonBarView.collectionViewLayout as! UICollectionViewFlowLayout
|
||||
let numberOfCells = viewControllers.count
|
||||
|
||||
var minimumCellWidths = [CGFloat]()
|
||||
var collectionViewContentWidth: CGFloat = 0
|
||||
|
||||
for viewController in self.viewControllers {
|
||||
for viewController in viewControllers {
|
||||
let childController = viewController as! IndicatorInfoProvider
|
||||
let indicatorInfo = childController.indicatorInfo(for: self)
|
||||
switch buttonBarItemSpec! {
|
||||
|
|
@ -290,14 +290,14 @@ open class BaseButtonBarPagerTabStripViewController<ButtonBarCellType : UICollec
|
|||
let cellSpacingTotal = CGFloat(numberOfCells - 1) * flowLayout.minimumLineSpacing
|
||||
collectionViewContentWidth += cellSpacingTotal
|
||||
|
||||
let collectionViewAvailableVisibleWidth = self.buttonBarView.frame.size.width - flowLayout.sectionInset.left - flowLayout.sectionInset.right
|
||||
let collectionViewAvailableVisibleWidth = buttonBarView.frame.size.width - flowLayout.sectionInset.left - flowLayout.sectionInset.right
|
||||
|
||||
if !settings.style.buttonBarItemsShouldFillAvailiableWidth || collectionViewAvailableVisibleWidth < collectionViewContentWidth {
|
||||
return minimumCellWidths
|
||||
}
|
||||
else {
|
||||
let stretchedCellWidthIfAllEqual = (collectionViewAvailableVisibleWidth - cellSpacingTotal) / CGFloat(numberOfCells)
|
||||
let generalMinimumCellWidth = self.calculateStretchedCellWidths(minimumCellWidths, suggestedStretchedCellWidth: stretchedCellWidthIfAllEqual, previousNumberOfLargeCells: 0)
|
||||
let generalMinimumCellWidth = calculateStretchedCellWidths(minimumCellWidths, suggestedStretchedCellWidth: stretchedCellWidthIfAllEqual, previousNumberOfLargeCells: 0)
|
||||
var stretchedCellWidths = [CGFloat]()
|
||||
|
||||
for minimumCellWidthValue in minimumCellWidths {
|
||||
|
|
|
|||
|
|
@ -66,34 +66,14 @@ public struct ButtonBarPagerTabStripSettings {
|
|||
|
||||
open class ButtonBarPagerTabStripViewController: PagerTabStripViewController, PagerTabStripDataSource, PagerTabStripIsProgressiveDelegate, UICollectionViewDelegate, UICollectionViewDataSource {
|
||||
|
||||
open var settings = ButtonBarPagerTabStripSettings()
|
||||
public var settings = ButtonBarPagerTabStripSettings()
|
||||
|
||||
lazy open var buttonBarItemSpec: ButtonBarItemSpec<ButtonBarViewCell> = .nibFile(nibName: "ButtonCell", bundle: Bundle(for: ButtonBarViewCell.self), width:{ [weak self] (childItemInfo) -> CGFloat in
|
||||
let label = UILabel()
|
||||
label.translatesAutoresizingMaskIntoConstraints = false
|
||||
label.font = self?.settings.style.buttonBarItemFont
|
||||
label.text = childItemInfo.title
|
||||
let labelSize = label.intrinsicContentSize
|
||||
return labelSize.width + (self?.settings.style.buttonBarItemLeftRightMargin ?? 8) * 2
|
||||
})
|
||||
public var buttonBarItemSpec: ButtonBarItemSpec<ButtonBarViewCell>!
|
||||
|
||||
open var changeCurrentIndex: ((_ oldCell: ButtonBarViewCell?, _ newCell: ButtonBarViewCell?, _ animated: Bool) -> Void)?
|
||||
open var changeCurrentIndexProgressive: ((_ oldCell: ButtonBarViewCell?, _ newCell: ButtonBarViewCell?, _ progressPercentage: CGFloat, _ changeCurrentIndex: Bool, _ animated: Bool) -> Void)?
|
||||
public var changeCurrentIndex: ((_ oldCell: ButtonBarViewCell?, _ newCell: ButtonBarViewCell?, _ animated: Bool) -> Void)?
|
||||
public var changeCurrentIndexProgressive: ((_ oldCell: ButtonBarViewCell?, _ newCell: ButtonBarViewCell?, _ progressPercentage: CGFloat, _ changeCurrentIndex: Bool, _ animated: Bool) -> Void)?
|
||||
|
||||
@IBOutlet open lazy var buttonBarView: ButtonBarView! = { [unowned self] in
|
||||
var flowLayout = UICollectionViewFlowLayout()
|
||||
flowLayout.scrollDirection = .horizontal
|
||||
let buttonBarHeight = self.settings.style.buttonBarHeight ?? 44
|
||||
let buttonBar = ButtonBarView(frame: CGRect(x: 0, y: 0, width: self.view.frame.size.width, height: buttonBarHeight), collectionViewLayout: flowLayout)
|
||||
buttonBar.backgroundColor = .orange
|
||||
buttonBar.selectedBar.backgroundColor = .black
|
||||
buttonBar.autoresizingMask = .flexibleWidth
|
||||
var newContainerViewFrame = self.containerView.frame
|
||||
newContainerViewFrame.origin.y = buttonBarHeight
|
||||
newContainerViewFrame.size.height = self.containerView.frame.size.height - (buttonBarHeight - self.containerView.frame.origin.y)
|
||||
self.containerView.frame = newContainerViewFrame
|
||||
return buttonBar
|
||||
}()
|
||||
@IBOutlet public weak var buttonBarView: ButtonBarView!
|
||||
|
||||
lazy private var cachedCellWidths: [CGFloat]? = { [unowned self] in
|
||||
return self.calculateWidths()
|
||||
|
|
@ -113,6 +93,31 @@ open class ButtonBarPagerTabStripViewController: PagerTabStripViewController, Pa
|
|||
|
||||
open override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
buttonBarItemSpec = .nibFile(nibName: "ButtonCell", bundle: Bundle(for: ButtonBarViewCell.self), width:{ [weak self] (childItemInfo) -> CGFloat in
|
||||
let label = UILabel()
|
||||
label.translatesAutoresizingMaskIntoConstraints = false
|
||||
label.font = self?.settings.style.buttonBarItemFont
|
||||
label.text = childItemInfo.title
|
||||
let labelSize = label.intrinsicContentSize
|
||||
return labelSize.width + (self?.settings.style.buttonBarItemLeftRightMargin ?? 8) * 2
|
||||
})
|
||||
|
||||
|
||||
let buttonBarViewAux = buttonBarView ?? {
|
||||
let flowLayout = UICollectionViewFlowLayout()
|
||||
flowLayout.scrollDirection = .horizontal
|
||||
let buttonBarHeight = settings.style.buttonBarHeight ?? 44
|
||||
let buttonBar = ButtonBarView(frame: CGRect(x: 0, y: 0, width: view.frame.size.width, height: buttonBarHeight), collectionViewLayout: flowLayout)
|
||||
buttonBar.backgroundColor = .orange
|
||||
buttonBar.selectedBar.backgroundColor = .black
|
||||
buttonBar.autoresizingMask = .flexibleWidth
|
||||
var newContainerViewFrame = containerView.frame
|
||||
newContainerViewFrame.origin.y = buttonBarHeight
|
||||
newContainerViewFrame.size.height = containerView.frame.size.height - (buttonBarHeight - containerView.frame.origin.y)
|
||||
containerView.frame = newContainerViewFrame
|
||||
return buttonBar
|
||||
}()
|
||||
buttonBarView = buttonBarViewAux
|
||||
|
||||
if buttonBarView.superview == nil {
|
||||
view.addSubview(buttonBarView)
|
||||
|
|
@ -129,7 +134,7 @@ open class ButtonBarPagerTabStripViewController: PagerTabStripViewController, Pa
|
|||
flowLayout.minimumInteritemSpacing = 0
|
||||
flowLayout.minimumLineSpacing = settings.style.buttonBarMinimumLineSpacing ?? flowLayout.minimumLineSpacing
|
||||
let sectionInset = flowLayout.sectionInset
|
||||
flowLayout.sectionInset = UIEdgeInsetsMake(sectionInset.top, self.settings.style.buttonBarLeftContentInset ?? sectionInset.left, sectionInset.bottom, self.settings.style.buttonBarRightContentInset ?? sectionInset.right)
|
||||
flowLayout.sectionInset = UIEdgeInsetsMake(sectionInset.top, settings.style.buttonBarLeftContentInset ?? sectionInset.left, sectionInset.bottom, settings.style.buttonBarRightContentInset ?? sectionInset.right)
|
||||
|
||||
buttonBarView.showsHorizontalScrollIndicator = false
|
||||
buttonBarView.backgroundColor = settings.style.buttonBarBackgroundColor ?? buttonBarView.backgroundColor
|
||||
|
|
@ -137,7 +142,7 @@ open class ButtonBarPagerTabStripViewController: PagerTabStripViewController, Pa
|
|||
|
||||
buttonBarView.selectedBarHeight = settings.style.selectedBarHeight
|
||||
// register button bar item cell
|
||||
switch buttonBarItemSpec {
|
||||
switch buttonBarItemSpec! {
|
||||
case .nibFile(let nibName, let bundle, _):
|
||||
buttonBarView.register(UINib(nibName: nibName, bundle: bundle), forCellWithReuseIdentifier:"Cell")
|
||||
case .cellClass:
|
||||
|
|
@ -310,16 +315,16 @@ open class ButtonBarPagerTabStripViewController: PagerTabStripViewController, Pa
|
|||
}
|
||||
|
||||
private func calculateWidths() -> [CGFloat] {
|
||||
let flowLayout = self.buttonBarView.collectionViewLayout as! UICollectionViewFlowLayout
|
||||
let numberOfCells = self.viewControllers.count
|
||||
let flowLayout = buttonBarView.collectionViewLayout as! UICollectionViewFlowLayout
|
||||
let numberOfCells = viewControllers.count
|
||||
|
||||
var minimumCellWidths = [CGFloat]()
|
||||
var collectionViewContentWidth: CGFloat = 0
|
||||
|
||||
for viewController in self.viewControllers {
|
||||
for viewController in viewControllers {
|
||||
let childController = viewController as! IndicatorInfoProvider
|
||||
let indicatorInfo = childController.indicatorInfo(for: self)
|
||||
switch buttonBarItemSpec {
|
||||
switch buttonBarItemSpec! {
|
||||
case .cellClass(let widthCallback):
|
||||
let width = widthCallback(indicatorInfo)
|
||||
minimumCellWidths.append(width)
|
||||
|
|
@ -334,14 +339,14 @@ open class ButtonBarPagerTabStripViewController: PagerTabStripViewController, Pa
|
|||
let cellSpacingTotal = CGFloat(numberOfCells - 1) * flowLayout.minimumLineSpacing
|
||||
collectionViewContentWidth += cellSpacingTotal
|
||||
|
||||
let collectionViewAvailableVisibleWidth = self.buttonBarView.frame.size.width - flowLayout.sectionInset.left - flowLayout.sectionInset.right
|
||||
let collectionViewAvailableVisibleWidth = buttonBarView.frame.size.width - flowLayout.sectionInset.left - flowLayout.sectionInset.right
|
||||
|
||||
if !settings.style.buttonBarItemsShouldFillAvailiableWidth || collectionViewAvailableVisibleWidth < collectionViewContentWidth {
|
||||
return minimumCellWidths
|
||||
}
|
||||
else {
|
||||
let stretchedCellWidthIfAllEqual = (collectionViewAvailableVisibleWidth - cellSpacingTotal) / CGFloat(numberOfCells)
|
||||
let generalMinimumCellWidth = self.calculateStretchedCellWidths(minimumCellWidths, suggestedStretchedCellWidth: stretchedCellWidthIfAllEqual, previousNumberOfLargeCells: 0)
|
||||
let generalMinimumCellWidth = calculateStretchedCellWidths(minimumCellWidths, suggestedStretchedCellWidth: stretchedCellWidthIfAllEqual, previousNumberOfLargeCells: 0)
|
||||
var stretchedCellWidths = [CGFloat]()
|
||||
|
||||
for minimumCellWidthValue in minimumCellWidths {
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ open class ButtonBarView: UICollectionView {
|
|||
|
||||
internal var selectedBarHeight: CGFloat = 4 {
|
||||
didSet {
|
||||
self.updateSlectedBarYPosition()
|
||||
updateSlectedBarYPosition()
|
||||
}
|
||||
}
|
||||
var selectedBarAlignment: SelectedBarAlignment = .center
|
||||
|
|
|
|||
|
|
@ -53,11 +53,7 @@ public protocol PagerTabStripDataSource: class {
|
|||
|
||||
open class PagerTabStripViewController: UIViewController, UIScrollViewDelegate {
|
||||
|
||||
@IBOutlet lazy open var containerView: UIScrollView! = { [unowned self] in
|
||||
let containerView = UIScrollView(frame: CGRect(x: 0, y: 0, width: self.view.bounds.width, height: self.view.bounds.height))
|
||||
containerView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
|
||||
return containerView
|
||||
}()
|
||||
@IBOutlet weak public var containerView: UIScrollView!
|
||||
|
||||
open weak var delegate: PagerTabStripDelegate?
|
||||
open weak var datasource: PagerTabStripDataSource?
|
||||
|
|
@ -91,6 +87,12 @@ open class PagerTabStripViewController: UIViewController, UIScrollViewDelegate {
|
|||
|
||||
override open func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
let conteinerViewAux = containerView ?? {
|
||||
let containerView = UIScrollView(frame: CGRect(x: 0, y: 0, width: view.bounds.width, height: view.bounds.height))
|
||||
containerView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
|
||||
return containerView
|
||||
}()
|
||||
containerView = conteinerViewAux
|
||||
if containerView.superview == nil {
|
||||
view.addSubview(containerView)
|
||||
}
|
||||
|
|
@ -152,7 +154,7 @@ open class PagerTabStripViewController: UIViewController, UIScrollViewDelegate {
|
|||
//MARK: - PagerTabStripDataSource
|
||||
|
||||
open func viewControllers(for pagerTabStripController: PagerTabStripViewController) -> [UIViewController] {
|
||||
assertionFailure("Sub-class must implement the PagerTabStripDataSource viewControllersForPagerTabStrip: method")
|
||||
assertionFailure("Sub-class must implement the PagerTabStripDataSource viewControllers(for:) method")
|
||||
return []
|
||||
}
|
||||
|
||||
|
|
@ -359,9 +361,9 @@ open class PagerTabStripViewController: UIViewController, UIScrollViewDelegate {
|
|||
viewControllers = dataSource.viewControllers(for: self)
|
||||
// viewControllers
|
||||
guard viewControllers.count != 0 else {
|
||||
fatalError("viewControllersForPagerTabStrip should provide at least one child view controller")
|
||||
fatalError("viewControllers(for:) should provide at least one child view controller")
|
||||
}
|
||||
viewControllers.forEach { if !($0 is IndicatorInfoProvider) { fatalError("Every view controller provided by PagerTabStripDataSource's viewControllersForPagerTabStrip method must conform to InfoProvider") }}
|
||||
viewControllers.forEach { if !($0 is IndicatorInfoProvider) { fatalError("Every view controller provided by PagerTabStripDataSource's viewControllers(for:) method must conform to InfoProvider") }}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ public struct SegmentedPagerTabStripSettings {
|
|||
|
||||
open class SegmentedPagerTabStripViewController: PagerTabStripViewController, PagerTabStripDataSource, PagerTabStripDelegate {
|
||||
|
||||
@IBOutlet lazy open var segmentedControl: UISegmentedControl! = UISegmentedControl()
|
||||
@IBOutlet weak public var segmentedControl: UISegmentedControl!
|
||||
|
||||
open var settings = SegmentedPagerTabStripSettings()
|
||||
|
||||
|
|
@ -58,6 +58,7 @@ open class SegmentedPagerTabStripViewController: PagerTabStripViewController, Pa
|
|||
|
||||
open override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
segmentedControl = segmentedControl ?? UISegmentedControl()
|
||||
if segmentedControl.superview == nil {
|
||||
navigationItem.titleView = segmentedControl
|
||||
}
|
||||
|
|
|
|||
|
|
@ -124,7 +124,9 @@ open class TwitterPagerTabStripViewController: PagerTabStripViewController, Page
|
|||
}
|
||||
|
||||
deinit {
|
||||
titleView.removeObserver(self, forKeyPath: "frame")
|
||||
if isViewLoaded {
|
||||
titleView.removeObserver(self, forKeyPath: "frame")
|
||||
}
|
||||
}
|
||||
|
||||
open override func viewDidLayoutSubviews() {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 46;
|
||||
objectVersion = 48;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
|
|
@ -240,7 +240,7 @@
|
|||
};
|
||||
};
|
||||
buildConfigurationList = 28F828771C494B2C00330CF4 /* Build configuration list for PBXProject "XLPagerTabStrip" */;
|
||||
compatibilityVersion = "Xcode 3.2";
|
||||
compatibilityVersion = "Xcode 8.0";
|
||||
developmentRegion = English;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
|
|
|
|||
Loading…
Reference in New Issue