DZNSegmentedControl icon indicating copy to clipboard operation
DZNSegmentedControl copied to clipboard

Glue the SegmentedControl below the navigation bar ?

Open wongzigii opened this issue 10 years ago • 4 comments

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.

wongzigii avatar Nov 24 '15 13:11 wongzigii

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.

dzenbot avatar Nov 25 '15 09:11 dzenbot

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.

image

dzenbot avatar Nov 25 '15 10:11 dzenbot

Sounds wonderful. The first approach is a more easy way to achieve this.

wongzigii avatar Nov 26 '15 03:11 wongzigii

You can also have a look at https://github.com/bryankeller/BLKFlexibleHeightBar

pomarec avatar Jun 13 '16 08:06 pomarec