BaseButtonBarViewController now sets sectionInset in viewDidLoad
This commit is contained in:
parent
877c51ae67
commit
0aa17bb08a
|
|
@ -54,8 +54,8 @@ class YoutubeExampleViewController: BaseButtonBarPagerTabStripViewController<You
|
|||
settings.style.buttonBarItemTitleColor = .blackColor()
|
||||
settings.style.buttonBarItemsShouldFillAvailiableWidth = true
|
||||
|
||||
settings.style.buttonBarLeftContentInset = 20
|
||||
settings.style.buttonBarRightContentInset = 20
|
||||
settings.style.buttonBarLeftContentInset = 0
|
||||
settings.style.buttonBarRightContentInset = 0
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -35,7 +35,6 @@ public class BaseButtonBarPagerTabStripViewController<ButtonBarCellType : UIColl
|
|||
@IBOutlet public 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 buttonBar = ButtonBarView(frame: CGRectMake(0, 0, self.view.frame.size.width, self.settings.style.buttonBarHeight ?? 44), collectionViewLayout: flowLayout)
|
||||
buttonBar.backgroundColor = .orangeColor()
|
||||
|
|
@ -81,10 +80,13 @@ public class BaseButtonBarPagerTabStripViewController<ButtonBarCellType : UIColl
|
|||
flowLayout.scrollDirection = .Horizontal
|
||||
flowLayout.minimumInteritemSpacing = settings.style.buttonBarMinimumInteritemSpacing ?? flowLayout.minimumInteritemSpacing
|
||||
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)
|
||||
buttonBarView.showsHorizontalScrollIndicator = false
|
||||
buttonBarView.backgroundColor = settings.style.buttonBarBackgroundColor ?? buttonBarView.backgroundColor
|
||||
buttonBarView.selectedBar.backgroundColor = settings.style.selectedBarBackgroundColor ?? buttonBarView.selectedBar.backgroundColor
|
||||
|
||||
buttonBarView.selectedBarHeight = settings.style.selectedBarHeight ?? buttonBarView.selectedBarHeight
|
||||
// register button bar item cell
|
||||
switch buttonBarItemSpec! {
|
||||
case .NibFile(let nibName, let bundle, _):
|
||||
|
|
|
|||
|
|
@ -127,7 +127,8 @@ public class ButtonBarPagerTabStripViewController: PagerTabStripViewController,
|
|||
flowLayout.scrollDirection = .Horizontal
|
||||
flowLayout.minimumInteritemSpacing = settings.style.buttonBarMinimumInteritemSpacing ?? flowLayout.minimumInteritemSpacing
|
||||
flowLayout.minimumLineSpacing = settings.style.buttonBarMinimumLineSpacing ?? flowLayout.minimumLineSpacing
|
||||
flowLayout.sectionInset = UIEdgeInsetsMake(0, self.settings.style.buttonBarLeftContentInset ?? 35, 0, self.settings.style.buttonBarRightContentInset ?? 35)
|
||||
let sectionInset = flowLayout.sectionInset
|
||||
flowLayout.sectionInset = UIEdgeInsetsMake(sectionInset.top, self.settings.style.buttonBarLeftContentInset ?? sectionInset.left, sectionInset.bottom, self.settings.style.buttonBarRightContentInset ?? sectionInset.right)
|
||||
|
||||
buttonBarView.showsHorizontalScrollIndicator = false
|
||||
buttonBarView.backgroundColor = settings.style.buttonBarBackgroundColor ?? buttonBarView.backgroundColor
|
||||
|
|
|
|||
Loading…
Reference in New Issue