2017-11-06 53 views
0

XLPagerTabStripを使用していますが、ScrollviewとcollectionViewの名前コンテナとButtonBarViewがあります。タブ項目の可視性以外はすべて正常に機能しています。タブを等分してタブを分割するようなものが欲しい。 enter image description hereXLPagerTabStripタブの画面幅が等しくない:Swift

Parantコントローラのコードは次のとおりです。

import UIKit 
import XLPagerTabStrip 

class ParentViewController: ButtonBarPagerTabStripViewController { 

let purpleInspireColor = UIColor(red:0.13, green:0.03, blue:0.25, alpha:1.0) 
override func viewDidLoad() { 
    super.viewDidLoad() 
    self.edgesForExtendedLayout = [] 

    // change selected bar color 
    settings.style.buttonBarBackgroundColor = .white 
    settings.style.buttonBarItemBackgroundColor = .white 
    settings.style.selectedBarBackgroundColor = purpleInspireColor 
    settings.style.buttonBarItemFont = .boldSystemFont(ofSize: 14) 
    settings.style.selectedBarHeight = 2.0 
    settings.style.buttonBarMinimumLineSpacing = 0 
    settings.style.buttonBarItemTitleColor = .black 
    settings.style.buttonBarItemsShouldFillAvailiableWidth = true 
    settings.style.buttonBarLeftContentInset = 0 
    settings.style.buttonBarRightContentInset = 0 
    changeCurrentIndexProgressive = { [weak self] (oldCell: ButtonBarViewCell?, newCell: ButtonBarViewCell?, progressPercentage: CGFloat, changeCurrentIndex: Bool, animated: Bool) -> Void in 
     guard changeCurrentIndex == true else { return } 
     oldCell?.label.textColor = .black 
     newCell?.label.textColor = self?.purpleInspireColor 
    } 

} 


override func viewControllers(for pagerTabStripController: PagerTabStripViewController) -> [UIViewController] { 
    let included = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "IncludedViewController") 
    let premium = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "PremiumViewController") 
    // let luxury = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "LuxuryViewController") 
    return [included,premium] 
} 
} 

私は含まれており、プレミアムという名前の2つのタブがあります。

答えて

1

この質問に回答が見つかりました

Xcodeプロジェクトのポッドファイルに移動します。 UICollectionViewDelegateをUICollectionViewDelegateFlowLayoutに変更します。

クラスButtonBarPagerTabStripViewController:PagerTabStripViewController、PagerTabStripDataSource、PagerTabStripIsProgressiveDelegate、UICollectionViewDataSource、UICollectionViewDelegateFlowLayout

関連する問題