Xlpagertabstrip: ButtonBar sticks behind Navigation Bar

Created on 13 Oct 2016  路  7Comments  路  Source: xmartlabs/XLPagerTabStrip

I use the default ButtonBar and everything works fine but the bar is hidden when I have a navigation bar enabled like this:
https://i.stack.imgur.com/PCp4w.png
If I hide the navigation bar, it shows like this:
https://i.stack.imgur.com/Wt0US.png
How do I get it below the navigation bar not behind it, because I need the navigation bar right there?

`
import UIKit
import XLPagerTabStrip

class DesignersController: ButtonBarPagerTabStripViewController {

override func viewDidLoad() {

    buttonBarView.backgroundColor = .white
    settings.style.buttonBarBackgroundColor = .white
    settings.style.selectedBarBackgroundColor = UIColor(netHex: 0x4a4a4a)
    settings.style.selectedBarHeight = 1
    settings.style.buttonBarItemBackgroundColor = .white
    settings.style.buttonBarItemTitleColor = UIColor(netHex: 0x8c8c8c)

    super.viewDidLoad()
}

var isReload = false

override func viewControllers(for pagerTabStripController: PagerTabStripViewController) -> [UIViewController] {
    let child_1 = ChildExampleViewController(itemInfo: "Top")
    let child_2 = ChildExampleViewController(itemInfo: "Men")
    let child_3 = ChildExampleViewController(itemInfo: "Women")

    guard isReload else {
        return [child_1, child_2, child_3]
    }

    var childViewControllers = [child_1, child_2, child_3]

    for (index, _) in childViewControllers.enumerated(){
        let nElements = childViewControllers.count - index
        let n = (Int(arc4random()) % nElements) + index
        if n != index{
            swap(&childViewControllers[index], &childViewControllers[n])
        }
    }
    let nItems = 1 + (arc4random() % 8)
    return Array(childViewControllers.prefix(Int(nItems)))
}

override func reloadPagerTabStripView() {
    isReload = true
    if arc4random() % 2 == 0 {
        pagerBehaviour = .progressive(skipIntermediateViewControllers: arc4random() % 2 == 0, elasticIndicatorLimit: arc4random() % 2 == 0 )
    }
    else {
        pagerBehaviour = .common(skipIntermediateViewControllers: arc4random() % 2 == 0)
    }
    super.reloadPagerTabStripView()
}

}
`

Thanks in advance

Most helpful comment

navigationController.navigationBar.isTranslucent = false

All 7 comments

Im using Xcode 8 and swift 2.3
I had the same problem when Im not using buttonBarView Outlet (it works fine without navigation bar)
it fixed when I used a collectionView and connected the buttonBarView Outlet of my tab controller but when the view appears tabs are not positioned properly

**I found the solution to that here #253

Thank you, worked fine

navigationController.navigationBar.isTranslucent = false

Thanks @hectorerb its working for me

Thank you @hectorerb you saved me!

Thanks you @hectorerb you saved me too !

self.edgesForExtendedLayout = UIRectEdge()

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fenixsolorzano picture fenixsolorzano  路  4Comments

hamzabinamin picture hamzabinamin  路  5Comments

nikhil191090 picture nikhil191090  路  5Comments

Emasoft picture Emasoft  路  5Comments

emrecanozturk picture emrecanozturk  路  5Comments