• Stars
    star
    2,033
  • Rank 22,758 (Top 0.5 %)
  • Language
    Swift
  • License
    MIT License
  • Created about 10 years ago
  • Updated over 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

:octocat: AdaptiveController is a 'Progressive Reduction' Swift UI module for adding custom states to Native or Custom iOS UI elements. Swift UI component by @Ramotion

ADAPTIVE TAB BAR

'Progressive Reduction' module for adding custom states to Native or Custom UI elements.


We specialize in the designing and coding of custom UI for Mobile Apps and Websites.

Stay tuned for the latest updates:


CocoaPods CocoaPods Twitter Travis Donate

Tab Bar After Install

Animation

Tab Bar After Two Weeks

Animation

Tab Bar After a Month

Animation

Overview

AdaptiveController is module for adding custom states to Native or Custom UI elements. The UI elements evolve over time as the user becomes accustomed to them. An example AdaptiveTabBar is provided.

How to import the control to your project

  1. First, drag and drop the AdaptiveController project file into your project or select "add existing file" and choose the AdaptiveController project
  2. Add AdaptiveController to your Target Dependences in the Build Phase of your project.
  3. Add the AdaptiveController framework in Link Binary With Libraries in Build Phases
  4. Import AdaptiveController where needed.

Using AdaptiveController

First, you should set the install date, current date, count of days to transition to small text state, and count of days to transition to big image state. The AdaptiveDateState object automatically determines what UI state to show:

    var installDate = NSDate(dateString:"2014-09-18")
    var adaptiveState = AdaptiveDateState(installDate: installDate, currentDate:NSDate(), countDaysToSmallTextState:countDaysToSmallTextState, countDaysToImageState:countDaysToImageState)

Or count of launches for different state:

    var curentCountLaunches = 6
    var adaptiveState = AdaptiveLaunchesState(curentCountLaunches:curentCountLaunches, countLaunchesToSmallTextState:5, countLaunchesToImageState:7)

And then you should setup an array of appearances. You should setup button images for each state for each apperance object:

    var buttonsAppearances = buttonsAppearancesGenerate() //func butonsAppearancesGenerate() -> [AdaptiveButtonApperance]

And then you should setup an array of items Appearance object. You should set the button's image for each state for each appearance object.

First, you should setup a dictionary for the extension of the image for each UI state:

    var imageExtensionsForStates:Dictionary = [ kSmallTitleAdaptiveState:"_smalltitle", kImageAdaptiveState:"_bigimage", kSmallTitleAdaptiveState+selected :"_smalltitle", kImageAdaptiveState+selected:"_bigimage" ]

Then you should set the Appearance for each UITabBarItem title for each state, fonts for each state, a default image if you describe an extension for each state, or if you do not describe an extension, you should setup each image for each state.

First, init the appearance object and setup the text for each state. If the text is the same for each state, you can set text for the default state:

    var watchAppearance = AdaptiveButtonAppearance(); 
    watchAppearance.setButonTitle("watch", state: kDefaultAdaptiveState)
    watchAppearance.setButonTitle("watch", state: kSmallTitleAdaptiveState)
    watchAppearance.setButonTitle("", state: kImageAdaptiveState)

Then you should setup your fonts for each state:

    watchAppearance.setButonTitleFontForState(yourDefaultFont, state: kDefaultAdaptiveState)
    watchAppearance.setButonTitleFontForState(yourDefaultSmallTitleModeFont, state: kSmallTitleAdaptiveState)

Then you should set the default image and extensions for each state a function which automaticaly sets images for each state:

    watchAppearance.setImageNamesForStatesImageExtesions("watch", imageExtensionsForState:imageExtensionsForStates)

Then you should setup the appearance insets for each state:

    watchAppearance.setImageInsets(defaultInsets, state: kDefaultAdaptiveState);
    watchAppearance.setImageInsets(defaultSmallTitleModeImageInsets, state: kSmallTitleAdaptiveState)
    watchAppearance.setTitleOffset(defaultOffset, state: kDefaultAdaptiveState)
    watchAppearance.setImageInsets(defaultImageModeInsets, state: kImageAdaptiveState);

Then you should setup ัustom UITabBarItems which conform to the AdaptiveButtonsProtocol:

    var arrayButtons = tabBar.items as [AdaptiveTabBarItem]

In your custom tab item, you should implement these methods from the protocol:

    @objc protocol AdaptiveApperanceProtocol {
        optional func setFontToAdaptiveButton(font: UIFont)
        optional func setTitleToAdaptiveButton(text: NSString)
        optional func setImageToAdaptiveButton(image: UIImage?)
        optional func setHighlightedToAdaptiveButton(image: UIImage?)
        optional func setBackgroundImageToAdaptiveButton(image: UIImage?)
        optional func setSelectedImageToAdaptiveButton(image: UIImage?)
        optional func setImageInsetsToAdaptiveButton(insets: UIEdgeInsets)
        optional func setTitleOffsetToAdaptiveButton(offset: UIOffset)
        optional func setTitleColorToAdaptiveButton(titleColor: UIColor)
    }

An example implemetation of a protocol method from our custom tab bar item:

    func setTitleToAdaptiveButton(text: NSString) {
    	self.title = text
	}

Finally, you should init Adaptive State Manager with the objects you've setup:

	AdaptiveButtonsStateManager(state: adaptiveState, buttonsAray:arrayButtons, buttonsAppearance:butonsAppearances)

##Using Custom States For AdaptiveController

Like UITabBar for different custom applications states

We have a default AdaptiveState and with the help of inheritance, we can add new custom states to our state class. The new class in our situation is named AdaptiveDateState

In AdaptiveDateState, we can add new custom states like this:

	let kSmallTitleAdaptiveState = "kImageAdaptiveState"
	let kImageAdaptiveState = "kNormalImageAdaptiveState"

And add methods which decide how the state relates to input parameters:

	var adaptiveState = AdaptiveDateState(installDate: installDate,currentDate:NSDate(),countDaysToSmallTextState:countDaysToSmallTextState,countDaysToImageState:countDaysToImageState)

In AdaptiveDateState, we add custom init methods which decided what states have the Adaptive state object according to the input parameters:

    private func stateRemainDays(remainDays:Int, countDaysToSmallTextState:Int, countDaysToImageState:Int)->String {
        var mode:String = kDefaultAdaptiveState
        print(" DAYS \(remainDays) ")
        if remainDays > countDaysToSmallTextState && remainDays < countDaysToImageState{
            mode = kSmallTitleAdaptiveState
        } else if remainDays > countDaysToImageState {
            mode = kImageAdaptiveState
        }
        print(mode)
        return mode
    }

You can customize different UI components if they adopt to the AdaptiveApperanceProtocol.

๐Ÿ“„ License

Adaptive Tab Bar is released under the MIT license. See LICENSE for details.

This library is a part of a selection of our best UI open-source projects.

If you use the open-source library in your project, please make sure to credit and backlink to www.ramotion.com

๐Ÿ“ฑ Get the Showroom App for iOS to give it a try

Try this UI component and more like this in our iOS app. Contact us if interested.



More Repositories

1

animated-tab-bar

:octocat: RAMAnimatedTabBarController is a Swift UI module library for adding animation to iOS tabbar items and icons. iOS library made by @Ramotion
Swift
11,119
star
2

folding-cell

:octocat: ๐Ÿ“ƒ FoldingCell is an expanding content cell with animation made by @Ramotion
Swift
10,219
star
3

expanding-collection

:octocat: ExpandingCollection is an animated material design UI card peek/pop controller. iOS library made by @Ramotion
Swift
5,551
star
4

folding-cell-android

:octocat: ๐Ÿ“ƒ FoldingCell is a material design expanding content cell inspired by folding paper material made by @Ramotion
Java
4,902
star
5

swift-ui-animation-components-and-libraries

Swift UI libraries, iOS components and animations by @Ramotion
Swift
3,680
star
6

circle-menu

:octocat: โญ•๏ธ CircleMenu is a simple, elegant UI menu with a circular layout and material design animations. Swift UI library made by @Ramotion
Swift
3,437
star
7

paper-onboarding

:octocat: PaperOnboarding is a material design UI slider. Swift UI library by @Ramotion
Swift
3,320
star
8

paper-switch

:octocat: ๐ŸŽš RAMPaperSwitch is a Swift material design UI module which paints over the parent view when the switch is turned on. iOS library by @Ramotion
Swift
2,935
star
9

paper-onboarding-android

:octocat: PaperOnboarding is a material design slider made by @Ramotion
Java
2,559
star
10

reel-search

:octocat: ๐Ÿ” RAMReel is a UI controller that allows you to choose options from a list. Swift UI library made by @Ramotion
Swift
2,537
star
11

cardslider-android

:octocat: ๐Ÿƒ Cardslider is a material design UI controller that allows you to swipe through cards with pictures and accompanying descriptions.
Java
2,348
star
12

navigation-stack

:octocat: NavigationStack is a stack-modeled UI navigation controller. Swift UI library made by @Ramotion
Swift
2,308
star
13

preview-transition

:octocat: PreviewTransition is a simple preview gallery UI controller with animated tranisitions. Swift UI library made by @Ramotion
Swift
2,084
star
14

android-ui-animation-components-and-libraries

Android UI libraries, components and animations by @ramotion
Java
2,068
star
15

expanding-collection-android

:octocat: ExpandingCollection is a material design card peek/pop controller. Android UI Library made by @Ramotion
Java
2,022
star
16

fluid-slider

:octocat:๐Ÿ’ง A slider widget with a popup bubble displaying the precise value selected. Swift UI library made by @Ramotion
Swift
1,970
star
17

circle-menu-android

:octocat: โญ•๏ธ CircleMenu is a simple, elegant UI menu with a circular layout and material design animations. Android UI library made by @Ramotion
Java
1,889
star
18

garland-view-android

:octocat: โ‰ก GarlandView seamlessly transitions between multiple lists of content. Made by @Ramotion
Java
1,838
star
19

aquarelle

:octocat: ๐ŸŽจ Aquarelle is a watercolor effect component. Javascript library by @Ramotion
JavaScript
1,801
star
20

gliding-collection

:octocat: Gliding Collection is a smooth, flowing, customizable decision for a UICollectionView Swift Controller. iOS library made by @Ramotion
Swift
1,530
star
21

fluid-slider-android

:octocat:๐Ÿ’ง A slider widget with a popup bubble displaying the precise value selected. Android library made by @Ramotion
Kotlin
1,424
star
22

cardslider

:octocat: ๐Ÿƒ Cardslider is a design UI controller that allows you to swipe through cards with pictures and accompanying descriptions.
Swift
1,271
star
23

elongation-preview

:octocat: ElongationPreview is an elegant UI push-pop style view controller. iOS library made by @Ramotion
Swift
898
star
24

navigation-toolbar-android

:octocat: Navigation toolbar is a slide-modeled UI navigation controller made by @Ramotion
Kotlin
820
star
25

navigation-toolbar

:octocat: Navigation toolbar is a slide-modeled UI navigation controller made by @Ramotion
Swift
595
star
26

react-native-circle-menu

:octocat: โญ•๏ธ CircleMenu is a simple, elegant UI menu with a circular layout and material design animations. Reactnative library made by @Ramotion
JavaScript
589
star
27

circular-carousel

List a collection of items in a horizontally scrolling view. A scaling factor controls the size of the items relative to the center.
Swift
582
star
28

direct-select-android

:octocat: โ‰ก DirectSelect is a selection widget with an ethereal, full-screen modal popup displaying the available choices when the widget is interact with.
Java
532
star
29

garland-view

:octocat: โ‰ก GarlandView seamlessly transitions between multiple lists of content. Swift UI library made by @Ramotion
Swift
501
star
30

showroom

Swift
167
star
31

vr-menu-demo

Prototype of a menu system in Virtual Reality. Javascript VR library made by @Ramotion
JavaScript
124
star
32

iOS-design-tips

Simple iOS design guidelines that will assist you in selecting the dimensions for your AppStore assets:
HTML
78
star
33

blob-menu

Swift
45
star
34

react-native-expanding-collection

JavaScript
37
star
35

showroom-android

Java
28
star
36

utopia

Swift
15
star
37

animations-web

JavaScript
9
star
38

react-native-fluid-slider

5
star
39

distorsion-blur

Swift
2
star