A UINavigationBar extension to show loading effects

Overview

BusyNavigationBar

Version License Platform

A UINavigationBar extension to show loading effects above navigation bar's background.

Screenshot

Stripes

gray_stripe.gif blue_stripe2.gif

Bars

gray_bar.gif green_bar.gif

Your custom layer

gray_bird.gif

Usage

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

use_frameworks!
pod "BusyNavigationBar"

Or add the following lines to your Cartfile:

github "gmertk/BusyNavigationBar" "master"

After installation is done, you can use the new methods of your navigation bar; start(_ options: BusyNavigationBarOptions) and stop().

Properties

var options = BusyNavigationBarOptions()

/**
    Animation type

    - Stripes: Sliding stripes as seen in Periscope app.
    - Bars: Bars going up and down like a wave.
    - CustomLayer(() -> CALayer): Your layer to be inserted in navigation bar. In this case, properties other than `transparentMaskEnabled` and `alpha` will not be used. 
*/
options.animationType = .Stripes

/// Color of the shapes. Defaults to gray.
options.color = UIColor.grayColor()

/// Alpha of the animation layer. Remember that there is also an additional (constant) gradient mask over the animation layer. Defaults to 0.5.
options.alpha = 0.5

/// Width of the bar. Defaults to 20.
options.barWidth = 20

/// Gap between bars. Defaults to 30.
options.gapWidth = 30

/// Speed of the animation. 1 corresponds to 0.5 sec. Defaults to 1.
options.speed = 1

/// Flag for enabling the transparent masking layer over the animation layer.
options.transparentMaskEnabled = true


// Start animation
self.navigationController?.navigationBar.start(options)

// Stop animation
self.navigationController?.navigationBar.stop()

Author

Günay Mert Karadoğan, [email protected]

License

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

More

There is a nice tutorial about Periscope's pull-to-refresh control by @bitwaker.

Comments
  • Back button not working when animated

    Back button not working when animated

    Hello

    First of all thanks for your library! I really like it and already used it in my application :). I found out that the back button is kind of blocked when the animation is running.

    I found out that if you want to have the UIView still beeing responsive you need to add the options UIViewAnimationOptions.AllowUserInteraction. So I changed the following code from:

    UIView.animateWithDuration(alphaAnimationDurationOfLoadingView, animations: { () -> Void in
        self.busy_loadingView!.alpha = self.busy_options.alpha
    })
    

    To this one:

    UIView.animateWithDuration(alphaAnimationDurationOfLoadingView, delay: 0.0, options: UIViewAnimationOptions.AllowUserInteraction, animations: { () -> Void in
        self.busy_loadingView!.alpha = self.busy_options.alpha
    }) { (finished) -> Void in
        // Finished..
    }
    

    But unfortunately the back button is still no responsive during animation..

    Tested with IOS 8.4 Xcode 6.4 (iPhone Simulator)

    opened by prine 5
  • Fix the Xcode project

    Fix the Xcode project

    Xcode shows the Swift 3 conversion dialog, although the code has been converted. This fixes the Swift version in the project and sets the provisioning settings to Automatic.

    Also, the (empty) tests haven't been converted to Swift 3.

    opened by bojan 1
  • Instead of using a UIView directly use a CALayer for the animation

    Instead of using a UIView directly use a CALayer for the animation

    This solves the issue that the back button wasn't pressable. I also adapted the Storyboard and added a button to directly test the Push feature in the Example.

    opened by prine 1
  • Better Installation Section

    Better Installation Section

    Hey, your library is really interesting.

    I created this iOS Open source Readme Template so you can take a look on how to easily make your Installation Section better If you want, I can help you to organize the lib

    What are your thoughts? 😄

    opened by lfarah 0
  • Bug while PullToRefresh is active (LargeTiles: On)

    Bug while PullToRefresh is active (LargeTiles: On)

    When PullToRefresh is activated the Bars get drawn at the exact Position. But shortly after that the Navigationbar shrinks back to its minimum Size (when pulled too far). The Already started BusyNavigationBars do not shrink / move up. Instead they just stay there. Any way to get around that behavior? (Any way to wait till the navigationbar is shrinked again and then display the busybars ? idk)

    image 2018-06-26 14 26 28

    CodeBlock:

    self.navigationController?.navigationBar.start(options) UIApplication.shared.isNetworkActivityIndicatorVisible = true Utils.reloadAdminData(completion: { (result) in DispatchQueue.main.async { self.data = result self.tableView.reloadData() UIApplication.shared.isNetworkActivityIndicatorVisible = false self.navigationController?.navigationBar.stop() self.refreshControl.endRefreshing() } })

    opened by undeaDD 1
  • not able import BusyNavigationBar to user

    not able import BusyNavigationBar to user

    I cann't import the BusyNavigationBar in my swift viewController after installing it with cocoapods? Do i need to implement it using source code? Please help

    opened by ErHimanshuK 0
  • installed but not working

    installed but not working

    Hi!😊 I installed using cocoapods successfully but the compiler still tell me "navigationBar has no property...."

    I also checked Link Binary With Libraries ,the framework was added.

    Here is my Podfile, anything wrong? Thanks in advance

    source 'https://github.com/CocoaPods/Specs.git' platform :ios, '8.0' use_frameworks!

    pod 'Kingfisher', '~> 2.2' pod "BusyNavigationBar"

    opened by Textcat 3
Owner
Günay Mert Karadoğan
Günay Mert Karadoğan
A UINavigationController subclass that support pop interactive UINavigationbar with hidden or show.

KDInteractiveNavigationController Features ✨ UINavigationController interactive with UINavigationBar hidden or show Hide all UINavigationController ba

Kingiol 154 Dec 3, 2022
UINavigationBar Category which allows you to change its appearance dynamically

Deprecated This lib uses a hacky way to achieve the result, in the new iOS version, the structure of UINavigation is changed and this lib no longer wo

Leo 4.5k Dec 3, 2022
Scrollable UINavigationBar that follows the scrolling of a UIScrollView

A custom UINavigationController that enables the scrolling of the navigation bar alongside the scrolling of an observed content view Versioning notes

Andrea Mazzini 6.1k Jan 6, 2023
An easy way to change backgroundColor of UINavigationBar when Push & Pop

RainbowNavigation 中文介绍 Feature RainbowNavigation is written in Swift 2.0. It helps you change the backgroundColor of UINavigationBar in animations and

danisfabric 789 Dec 3, 2022
Easily hide and show a view controller's navigation bar (and tab bar) as a user scrolls

HidingNavigationBar An easy to use library (written in Swift) that manages hiding and showing a navigation bar as a user scrolls. Features Usage Custo

Tristan Himmelman 1k Dec 21, 2022
NavigationViewKit is a NavigationView extension library for SwiftUI.

NavigationViewKit 中文版说明 NavigationViewKit is a NavigationView extension library for SwiftUI. For more detailed documentation and demo, please visit 用N

东坡肘子 74 Dec 28, 2022
iOS UI library to show and hide an extension to your UINavigationBar

ADNavigationBarExtension is a UI library written in Swift. It allows you to show and hide an extension to your UINavigationBar Features Use Extensible

FABERNOVEL 58 Aug 29, 2022
A UINavigationController subclass that support pop interactive UINavigationbar with hidden or show.

KDInteractiveNavigationController Features ✨ UINavigationController interactive with UINavigationBar hidden or show Hide all UINavigationController ba

Kingiol 154 Dec 3, 2022
A UINavigationController subclass that support pop interactive UINavigationbar with hidden or show.

KDInteractiveNavigationController Features ✨ UINavigationController interactive with UINavigationBar hidden or show Hide all UINavigationController ba

Kingiol 154 Dec 3, 2022
Show the weather effects onto view written in Swift4.2

URWeatherView What is this for? Showing some kinds of the weather effect, written in Swift4.2. This code style is the Protocol Oriented Programming. T

Urtaq 449 Dec 28, 2022
A SwiftUI view for dynamically rendering content based upon "loading", "error", and "completed" data loading states.

SwiftUIAsyncContentView A SwiftUI view for dynamically rendering content based upon "loading", "error", and "completed" data loading states.. Installa

CypherPoet 0 Dec 26, 2021
Scrollable UINavigationBar that follows the scrolling of a UIScrollView

A custom UINavigationController that enables the scrolling of the navigation bar alongside the scrolling of an observed content view Versioning notes

Andrea Mazzini 6.1k Dec 24, 2022
Zingle – An alert will display underneath your UINavigationBar 🎅

Zingle Zingle – An alert will display underneath your UINavigationBar ?? ?? Note: Zingle has a dependency to have a UINavigationController in your app

Hemang 109 Jun 24, 2022
UINavigationBar Category which allows you to change its appearance dynamically

Deprecated This lib uses a hacky way to achieve the result, in the new iOS version, the structure of UINavigation is changed and this lib no longer wo

Leo 4.5k Dec 3, 2022
Scrollable UINavigationBar that follows the scrolling of a UIScrollView

A custom UINavigationController that enables the scrolling of the navigation bar alongside the scrolling of an observed content view Versioning notes

Andrea Mazzini 6.1k Jan 6, 2023
An easy way to change backgroundColor of UINavigationBar when Push & Pop

RainbowNavigation 中文介绍 Feature RainbowNavigation is written in Swift 2.0. It helps you change the backgroundColor of UINavigationBar in animations and

danisfabric 789 Dec 3, 2022
Show pleasant loading view for your users 😍

RHPlaceholder ?? Because traditional loading view like UIActivityIndicatorView or similar one are no longer so trendy (Facebook or Instagram apps are

Robert Herdzik 238 Nov 2, 2022
SwiftUI project to show ActivityIndicator above Image while loading

ImageWithActivityIndicatorDemo SwiftUI project to show ActivityIndicator above Image while loading ImageWithActivityIndicatorDemo is a demo app that s

Ali Adam 4 May 27, 2021
Mahmoud-Abdelwahab 5 Nov 23, 2022