Open wongzigii opened 8 years ago
Depends of your layout.
If you're using UITableView or UICollectionView you can add the segmentedControl
as a floating section header view and give the impression it's stick to the navigation bar.
Another approach, would be to create a custom UINavigationBar subclass and do the hard work of actually extending the view to host the segmentedControl
.
This was an interesting challenge, so I took a few minutes to give it a try and it looks great. Have a look in this branch: https://github.com/dzenbot/DZNSegmentedControl/tree/navigation-bar-experiment
The only remaining bug is that the segmented control isn't reacting to touch events, for some reason.
Sounds wonderful. The first approach is a more easy way to achieve this.
You can also have a look at https://github.com/bryankeller/BLKFlexibleHeightBar
Great repo :+1: I just wondering is there an easy way to glue the segmentControl below navigation bar while scrolling? It will be great if there is an API to accomplish this.