Alan Smith Alan Smith - 5 years ago 746
Swift Question

How do i get the scrolling bar with buttons?

So first thing i have a news app so it has different category like business,national,state news and etc so i need a scrolling bar with button like this shown in the below image.

Bar with Buttons

i don't know what it is called tabbar, bar with buttons or there is something else storyboard.

i have searched every where one google but could not found it because i don't know what it is called

Till now i have try creating a vertical scrollview and adding buttons to it but if is not upto my staisfaction i want something better.. if you find any GitHub projects it will be good.

i even tried segmented control but it doesn't hold more category it becomes smaller and smaller so i want something like shown in the top image.


UPDATED


On click of any button i want to refresh the table view with the content of of category ...

Tab bar wont work

Thank You for your help in advance

Answer Source

Your answer was already given in the comment by Adrian B..

i ill explain you how you have to do it. first of all it is called Tab Swipe navigation

Make use of Carbon kit

https://github.com/melieskubrick/CarbonKitSwift

So first add the elements to your view. this is the way how you add using Carbon Kit

override func viewDidLoad() {
    super.viewDidLoad()

    self.title = "CarbonKit"
    items = [UIImage(named: "home")!, UIImage(named: "hourglass")!, UIImage(named: "premium_badge")!, "Categories", "Top Free", "Top New Free", "Top Paid", "Top New Paid"]
    carbonTabSwipeNavigation = CarbonTabSwipeNavigation(items: items as [AnyObject], delegate: self)
    carbonTabSwipeNavigation.insertIntoRootViewController(self)
    self.style()

}

You want to refresh your news so using delegate method of Carbon Kit which is CarbonTabSwipeNavigationDelegate you can refresh your tableview.

 func carbonTabSwipeNavigation(carbonTabSwipeNavigation: CarbonTabSwipeNavigation, viewControllerAtIndex index: UInt) -> UIViewController {

        switch index {
        case 0:
            //Do your table view refresh here Business category 
        case 1:
           //Do your table view  refresh here other category 

        default:
            //Do your table view  refresh here all category  which will be default

        }

    }

Credit

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download