All Projects → ivsall2012 → AHCategoryView

ivsall2012 / AHCategoryView

Licence: MIT license
A navigation view for categories

Programming Languages

swift
15916 projects
shell
77523 projects
objective c
16641 projects - #2 most used programming language
ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to AHCategoryView

Ultimatebarx
Make Android transparent statusbar and navigationbar easy.
Stars: ✭ 879 (+2931.03%)
Mutual labels:  navigationbar
Systemuihelper
Helper for dealing with Android System UI visibility
Stars: ✭ 108 (+272.41%)
Mutual labels:  navigationbar
Tiptoes
Simple navigation bar in the bottom, a beautiful discretion in your UI.
Stars: ✭ 221 (+662.07%)
Mutual labels:  navigationbar
React Native X Bar
🎩 A flexible, lightweight bar component for common UI patterns in React Native
Stars: ✭ 68 (+134.48%)
Mutual labels:  navigationbar
Customnavigationbarsample
Navigation Bar Customization in Xamarin Forms
Stars: ✭ 104 (+258.62%)
Mutual labels:  navigationbar
Edge To Edge
Full screen Android apps using simple Kotlin DSL
Stars: ✭ 118 (+306.9%)
Mutual labels:  navigationbar
Ypnavigationbartransition
A Full functional UINavigationBar framework for making bar transition more natural! You don't need to call any UINavigationBar api, implementing YPNavigationBarConfigureStyle protocol for your view controller instead. (类似微信 iOS Navigation Bar 的切换方案)
Stars: ✭ 725 (+2400%)
Mutual labels:  navigationbar
Easydropdown
💧 Fantastic dropdown in Swift
Stars: ✭ 254 (+775.86%)
Mutual labels:  navigationbar
Bubble Navigation
🎉 [Android Library] A light-weight library to easily make beautiful Navigation Bar with ton of 🎨 customization option.
Stars: ✭ 1,537 (+5200%)
Mutual labels:  navigationbar
Vhlnavigation
导航栏切换之颜色过渡切换,导航栏背景图片切换,微信红包两种不同颜色切换,导航栏透明度,有无导航栏切换
Stars: ✭ 210 (+624.14%)
Mutual labels:  navigationbar
Efnavigationbar
An ordinary custom navigation bar.
Stars: ✭ 92 (+217.24%)
Mutual labels:  navigationbar
Custom bubble navigation bar
A custom navigation bar with bubble click effect in Flutter
Stars: ✭ 104 (+258.62%)
Mutual labels:  navigationbar
Ios.blog.swiftui search bar in navigation bar
🔍 SwiftUI search bar in the navigation bar.
Stars: ✭ 124 (+327.59%)
Mutual labels:  navigationbar
Evncustomsearchbar
🔍Born for iOS 11 and iPhone X SearchBar
Stars: ✭ 52 (+79.31%)
Mutual labels:  navigationbar
Zxnavigationbar
灵活轻量的自定义导航栏,导航栏属于控制器view,支持导航栏联动,一行代码实现【导航栏背景图片设置、导航栏渐变、折叠、修改Item大小和边距、自定义导航栏高度、全屏手势返回、pop拦截、仿系统导航栏历史堆栈】等各种效果
Stars: ✭ 230 (+693.1%)
Mutual labels:  navigationbar
Animatedbottombar
A customizable and easy to use BottomBar navigation view with sleek animations, with support for ViewPager, ViewPager2, NavController, and badges.
Stars: ✭ 797 (+2648.28%)
Mutual labels:  navigationbar
Mtransparentnav
Change NavigationBar's color and transparency 导航栏颜色渐变,通过给viewController添加属性,可方便控制title、item、导航栏颜色变化
Stars: ✭ 109 (+275.86%)
Mutual labels:  navigationbar
RRNavigationBar
bring UINavigationBar to UIViewController.
Stars: ✭ 11 (-62.07%)
Mutual labels:  navigationbar
Teaset
A UI library for react native, provides 20+ pure JS(ES6) components, focusing on content display and action control.
Stars: ✭ 2,845 (+9710.34%)
Mutual labels:  navigationbar
React Site Nav
A kick ass site menu powered by styled components inspired by Stripe.
Stars: ✭ 155 (+434.48%)
Mutual labels:  navigationbar

AHCategoryView

AHCategoryView acts like a flexible UITabBarController, but upside down, for categorizing different pages of controllers in your app.

The following demo gif is a Pinterest style category navigation bar.

The following demo gif shows that the AHCategoryView's navBar is embedded into a native UINavigatonBar. |

usage

There are only 5 steps to use it:

  1. Adding AHCategoryItem(s) into an array. Each AHCategoryItem describes how a category tab looks like.
  2. Adding VCs into an array.
  3. Configuring AHCategoryView's naBar barStyle.
  4. Create a AHCategoryView instance with the item array and VC array then add it into a view.
  5. Optionally, when there's a related remote notification coming into your app for a specific category, you can use categoryView.setBadge to set badge number. See the second example code in the followings.

You will be spending most of the time creating those AHCategoryItem(s) and configuring a AHCategoryNavBarStyle. AHCategoryNavBarStyle is pretty self-explanatory. Read the comments in the source file if you get confused, or just try it out.

Example Code: Pinterest Style

///######## 1. Adding items
        var featureItem = AHCategoryItem()
        featureItem.title = "Feature"
        var chartItem = AHCategoryItem()
        chartItem.title = "Categories"
        var radioItem = AHCategoryItem()
        radioItem.title = "Radio"
        var liveItem = AHCategoryItem()
        liveItem.title = "Live"
        var searchItem = AHCategoryItem()
        searchItem.normalImage = UIImage(named: "search-magnifier")
        searchItem.selectedImage = UIImage(named: "search-magnifier")
        
        let items = [featureItem, chartItem, radioItem, liveItem, featureItem, chartItem, radioItem, liveItem, searchItem]
        
///######## 2. Adding VCs
        ///NOTE: You can have more items than VCs. In this case the searchItem is extra, so you won't be able to scroll VCs to the searchItem and you can only tap to it.
        for _ in 0..<8 {
            let vc = UIViewController()
            vc.view.backgroundColor = UIColor.random()
            childVCs.append(vc)
        }
        
///######## 3. Configuring barStyle
        var style = AHCategoryNavBarStyle()
//        style.contentInset.left = 100.0
//        style.contentInset.right = 100.0
        style.height = 44.0
        style.fontSize = 20.0
        style.selectedFontSize = 22.0
        style.interItemSpace = 5.0
        style.itemPadding = 8.0
        style.isScrollable = true
        style.layoutAlignment = .left
        /// The view here is referred to categoryView. So if isEmbeddedToView is true, it means the navBar(categoryView's) is attached with categoryView as a whole, instead of being used separately which is the case in the following example code.
        style.isEmbeddedToView = true
        style.showBottomSeparator = true
        style.showIndicator = false
        /// NOTE: The following two colors have to be created in RBG form in order to do a color transition when scrolling VCs.
        style.normalColor = UIColor(red: 0.7, green: 0.7, blue: 0.7, alpha: 1.0)
        style.selectedColor = UIColor(red: 0, green: 0, blue: 0, alpha: 1.0).withAlphaComponent(0.7)
        style.showBgMaskView = true
        style.bgMaskViewColor = UIColor.lightGray
        
//######### 4. Adding categoryView to view
        let frame = CGRect(x: 0, y: 64.0, width: ScreenSize.width, height: ScreenSize.height - 64.0)
        let categoryView = AHCategoryView(frame: frame, categories: items, childVCs: childVCs, parentVC: self, barStyle: style)
        categoryView.interControllerSpacing = 0.0
        self.view.addSubview(categoryView)
        self.categoryView = categoryView

Example Code: Embed AHCategoryView's navBar into a navigationItem.titleView

///######## 1. Adding items
        var meItem = AHCategoryItem()
        meItem.normalImage = UIImage(named: "me-normal")
        meItem.selectedImage = UIImage(named: "me-selected")
        
        
        var featureItem = AHCategoryItem()
        featureItem.title = "Feature"
        var chartItem = AHCategoryItem()
        chartItem.title = "Charts"
        var categoryItem = AHCategoryItem()
        categoryItem.title = "Categories"
        var radioItem = AHCategoryItem()
        radioItem.title = "Radio"
        var liveItem = AHCategoryItem()
        liveItem.title = "Live"
        
        
        let items = [meItem, featureItem, chartItem, categoryItem, radioItem, liveItem]
        
        ///######## 2. Adding VCs
        for _ in 0..<5 {
            let vc = UIViewController()
            vc.view.backgroundColor = UIColor.random()
            childVCs.append(vc)
        }
        
        
        ///######## 3. Configuring barStyle
        
        var style = AHCategoryNavBarStyle()
//        style.contentInset = .zero
        style.interItemSpace = 8.0
        style.itemPadding = 8.0
        style.isScrollable = false
        style.layoutAlignment = .left
        
        ///NOTE: If you want to embed categoryView.navBar into a navigationItem.titleView or some other view, you have to set style.isEmbeddedToView = false.
        /// The view here is referred to categoryView.
        style.isEmbeddedToView = false
        style.showBottomSeparator = false
        style.indicatorColor = UIColor(red: 244.0/255.0, green: 173.0/255.0, blue: 98.0/255.0, alpha: 1.0)
        style.normalColor = UIColor(red: 0, green: 0, blue: 0, alpha: 1.0)
        style.selectedColor = UIColor(red: 1, green: 0, blue: 0, alpha: 1.0)
        
        //######### 4. Attaching categoryView to navigationItem.titleView
        let frame = CGRect(x: 0, y: 64.0, width: ScreenSize.width, height: ScreenSize.height - 64.0)
        let categoryView = AHCategoryView(frame: frame, categories: items, childVCs: childVCs, parentVC: self, barStyle: style)
        self.view.addSubview(categoryView)
        self.categoryView = categoryView
        categoryView.navBar.frame = CGRect(x: 0, y: 0, width: 359.0, height: 44.0)
        categoryView.navBar.backgroundColor = UIColor.clear
        categoryView.select(at: 1)
        categoryView.setBadge(atIndex: 0, badgeNumber: 10)
        categoryView.setBadge(atIndex: 2, badgeNumber: 3)
        /// Embed navBar to navigationItem.titleView
        self.navigationItem.titleView = categoryView.navBar
        self.navigationController?.navigationBar.barTintColor = UIColor.white

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

iOS 8.0+

Installation

AHCategoryView is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "AHCategoryView"

Author

Anyd Tong, [email protected]

License

AHCategoryView is available under the MIT license. See the LICENSE file for more info.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].