Code Monkey home page Code Monkey logo

bdhoverviewcontroller's Introduction

This sample demonstrates the use of the BDHoverViewController. BDHoverViewController provides a modal view with shadow, that enables you to show the user that an activity such as internet access or long task is ongoing and that interacting with the user interface is not possible. There are four different versions of the hoverView:

  1. Exclusive Touch where only a UIView with alpha of 0.1 is shown.
  2. An exclusive touch UIView with a UIActivityIndicator
  3. An exclusive tough UIView with a UIActivityIndicator and UILabel for status.
  4. An exclusive touch UIView with a UIActivityIndicator, UILabel for status, and a UIProgressView
  5. An exclusive touch UIView that displays a UIImage that you supply.

BDHoverViewController makes extensive use of blocks in order to build the animations for transitions from one hoverView style to the other. The use of NSMutableArray and blocks allow the building of the animations on the fly.

Notes: As of 10/14/2011, BDHoverview has been converted to Automatic Reference Counting and will only work on iOS5 and greater.

Usage Adding the hoverview at runtime is easy.

  1. First create an instance of the BDHoverview as follows:

    hoverViewController_=[[BDHoverViewController alloc] initWithHoverStatusStyle:BDHoverViewStatusExclusiveTouchStyle
                                                                         options:BDHoverViewControllerOptionsShowBevel];
    hoverViewController_.modalTransitionStyle=UIModalTransitionStyleCrossDissolve;
    self.window.rootViewController.modalPresentationStyle=UIModalPresentationCurrentContext;
    [self.window.rootViewController presentModalViewController:hoverViewController_ animated:YES]; 

The initializers make use of the BDHoverViewControllerOptions type that set specific options such as whether or not a bevel (BDHoverViewControllerOptionsShowBevel)is show or a border (BDHoverViewControllerOptionsShowBorder) is drawn around the BDHoverView.

The BDHoverViewController adheres to the BDStatusUpdateProtocol. Therefore it will respond to the following update methods: To update just the UIProgressView use: -(void)updateHoverViewProgressWithProgressValue:(float)progress. Even if the BDHoverViewStatusActivityProgressStyle style is not being shown, the progressValue will be saved. This allows the progressView to be animated correctly, if and when you do choose to animate to the BDHoverViewStatusActivityProgressStyle. The usage is as follows.


    [hoverViewController_ updateHoverViewProgressWithProgressValue: 0.5f];

To update just the UILabel for status use: -(void)updateHoverViewStatus:(NSString *)status. Just like the with the UIProgressView above, this can be used even when the statusLabel is not visible to ensure that the status is available for when you choose to animate to a Hover View Status style that includes it. Here is the usage:


    [hoverViewController_ updateHoverViewStatus: @"Contacting App Store..."];

The status label and progress ui can be update at the same time using: -(void)updateHoverViewStatus:(NSString *)status progressValue:(float)progress. Here is the usage.


    [hoverViewController_ updateHoverViewStatus: @"Updating Files..." progressValue: 0.75f];

Animating from one Hover View Style to another is simple using this method: -(void)animateToHoverViewStatusStyle:(BDHoverViewStatusStyle)hoverViewStatusStyle completion:(void (^)(BOOL finished))completion. The completion block is useful for any other clean up code that you may want to execute.

[hoverViewController_ animateToHoverViewStyle:BDHoverViewStatusActivityProgressStyle
                                   completion:^(BOOL finished){
                                            NSLog(@"animation finished");
                                   }];

The Activity only style looks like this: activityScreenShot

The Activity with Status Label style looks like this: statusScreenShot

The Activity, Status, and Progress style looks like this: progressScreenShot

The Alert Image Style looks like this: alertImageScreenShot

License

The below license is the new BSD license with the OSI recommended personalizations. http://www.opensource.org/licenses/bsd-license.php

Copyright (C) 2011 Big Diggy SW. All Rights Reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  • Neither the name of Tim Taylor nor Big Diggy SW may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY Big Diggy SW "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

bdhoverviewcontroller's People

Contributors

toolmangithub avatar

Stargazers

Audio Filter avatar  avatar Ernesto García avatar Emanuele Sabetta avatar Oliver Dohmen avatar Willi Wu avatar

Watchers

 avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.