Closed billypap1 closed 3 years ago
@billypap1 thank you 😄🎉
That should certainly be possible - you can in fact add a bar to any custom UIView
and specify custom constraints if required...
When adding the bar simply use the .custom()
location:
let customContainer = UIView()
override func viewDidLoad() {
super.viewDidLoad()
let bar = TMBar.ButtonBar()
addBar(bar, dataSource: self, at: .custom(view: customContainer, layout: nil))
}
The layout
closure allows you to provide custom set up / constraints if set - otherwise the bar will be constrained at the leading, top, trailing and bottom anchors of the container view.
See Adding a bar for more info.
Hello, thanks for your quick response. I add the bar to the custom view but it is hidden. Should i configure something else? I have the set Tabman in a container view, and I want to set the Bar outside the container view, in a custom view in Parent View)
@billypap1 are you doing custom layout when adding the bar? If so make sure translatesAutoresizingMaskIntoConstraints = false
is set...
let customContainer = UIView()
override func viewDidLoad() {
super.viewDidLoad()
let bar = TMBar.ButtonBar()
addBar(bar, dataSource: self, at: .custom(view: customContainer, layout: { (bar) in
bar.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([
bar.leadingAnchor.constrain(equalTo: customContainer.leadingAnchor),
// more constraints...
)]
))
}
Might be useful to check out the view inspector in Xcode as well to see what exactly is happening.
New Issue Checklist
Issue Description
Hello, I have integrated Tabman in my project successfully. I think this plugin worths more than 1.9k Stars! I have a question about UiView of Bar, Is it possible to set the Bar outside the TabmanViewController? I have a header in main UIViewController and I'd like to set the Bar there. I want to achieve a scrollable fixed header, so it is better to be outside along with header's content. Or if there is some other way to "get" the UIView of Bar, that would be helpful.