Giter Club home page Giter Club logo

dejalactivityview's Introduction

DejalActivityView

DejalActivityView conveniently displays a horizontal, bezel-style, or keyboard-covering view with a spinning activity indicator and adjustable text.

Donations

I wrote DejalActivityView for my own use, but I'm making it available for the benefit of the iOS developer community.

If you find it useful, a donation via PayPal (or something from my Amazon.com Wish List) would be very much appreciated. Appropriate links can be found on the Dejal Developer page:

http://www.dejal.com/developer

Latest Version

You can find the latest version of this code via the GitHub repository:

https://github.com/Dejal/DejalActivityView

For news on updates, also check out the Dejal Developer page or the Dejal Blog filtered for DejalActivityView posts:

http://www.dejal.com/blog/dejalactivityview

Requirements

  • Xcode 4.2 or later.
  • iOS 5 or later.
  • ARC.

Features

  • DejalActivityView: a simple horizontal-style loading view, intended for situations where you have a blank view while loading data.
  • DejalWhiteActivityView: the same as the simple one, but with a white indicator and text instead of black, for use in dark views.
  • DejalBezelActivityView: an animated round-rect-enclosed variation, with a gray background covering the parent view.
  • DejalKeyboardActivityView: displays over the keyboard. Rarely used nowadays (and may be removed in a future version; let me know if you need it).
  • A demo project is included.

Usage

Include the DejalActivityView.h and DejalActivityView.m files in your project.

To display the basic DejalActivityView, simply use:

[DejalActivityView activityViewForView:self.view];

The activity view is automatically added as a subview of the specified view (e.g. the current content view). No need to save the result to an ivar.

You can instead specify a custom label via:

[DejalActivityView activityViewForView:self.view withLabel:@"Processing..."];

Or specify a custom width, e.g. so you can change the label while it is being displayed without upsetting the geometry, via:

[DejalActivityView activityViewForView:self.view withLabel:@"Connecting..." width:100];

You can also have it manage the network activity indicator in the status bar, e.g.:

[DejalActivityView activityViewForView:self.view].showNetworkActivityIndicator = YES;

Then when you're done with it, simply invoke this to get rid of it:

[DejalActivityView removeView];

The other variations are similar. So for example you can display DejalBezelActivityView via:

[DejalBezelActivityView activityViewForView:self.view];

The [DejalBezelActivityView activityViewForView:withLabel:] and [DejalBezelActivityView activityViewForView:withLabel:width:] variations are also available.

To remove with animation, call:

[DejalBezelActivityView removeViewAnimated:YES];

There are other options too; see the DejalActivityView blog posts for full details, screenshots, and a demo movie. Or try the included demo project.

License and Warranty

This code uses the standard BSD license. See the included License.txt file. Please also see the Dejal Open Source License web page for more information.

You can use this code at no cost, with attribution. A non-attribution license is also available, for a fee.

You're welcome to use it in commercial, closed-source, open source, free or any other kind of software, as long as you credit Dejal appropriately.

The placement and format of the credit is up to you, but I prefer the credit to be in the software's "About" window or view, if any. Alternatively, you could put the credit in the software's documentation, or on the web page for the product. The suggested format for the attribution is:

Includes DejalActivityView code from Dejal.

Where possible, please link the text "Dejal" to the Dejal Developer web page, or include the page's URL: http://www.dejal.com/developer/.

This code comes with no warranty of any kind. I hope it'll be useful to you, but I make no guarantees regarding its functionality or otherwise.

Credits

This work was inspired in part by Matt Gallagher's excellent article, Showing a "Loading..." message over the iPhone keyboard. My code only uses the -keyboardView method from his article, but he deserves credit and thanks for that and many other helpful articles.

Support / Contact / Bugs / Features

I can't promise to answer questions about how to use the code.

If you create an app that uses the code, please tell me about it.

If you want to submit a feature request or bug report, please use GitHub's issue tracker for this project. Or preferably fork the code and implement the feature/fix yourself, then submit a pull request.

Enjoy!

David Sinclair
Dejal Systems, LLC

Contact: http://www.dejal.com/contact/?subject=DejalActivityView&ref=dejalactivityview
More open source projects: http://www.dejal.com/developer
Open source announcements on Twitter: http://twitter.com/dejalopen
General Dejal news on Twitter: http://twitter.com/dejal

dejalactivityview's People

Contributors

dejal avatar graetzer avatar grzegorzkrukowski avatar vinnybad avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dejalactivityview's Issues

Changing the font

Is there an easy way to change the font of all DejalActivityViews?

Please add semantic version tags.

I want to add DejalActivityView to the CocoaPods package manager repo.

CocoaPods is a tool for managing dependencies for OSX and iOS Xcode projects and provides a central repository for iOS/OSX libraries. This makes adding libraries to a project and updating them extremely easy and it will help users to resolve dependencies of the libraries they use.

However, DejalActivityView doesn't have any version tags. I will add the current HEAD as version 0.0.1, but a version tag will make dependency resolution much easier.

Semantic version tags (instead of plain commit hashes/revisions) allow for resolution of cross-dependencies.

In case you didn’t know this yet; you can tag the current HEAD as, for instance, version 1.0.0, like so:

$ git tag -a 1.0.0 -m "Tag release 1.0.0"
$ git push --tags

Call backs for when animate on/off completes?

Why not add something like this...

@protocol DejalActivityViewDelegate

  • (void) dejalActivityViewDidAnimateOn;
    @optional
  • (void) dejalActivityViewDidAnimateOff;
    @EnD

and then give the base class

  • (void) setDelegate:(id)d;

so you can optionally use this to capture when the animate on or off finishes.

I have this working and would upload it for you if i knew how to

View appears behind a Table View

I am presenting the DejalBezelView in a UITableViewController. However, when displaying the Bezel view, it appears behind the table view.

Here is the code that I use to call the DejalBezel view.

[DejalBezelActivityView activityViewForView:self.view withLabel:@"Loading ..."];

See the attached image.

ios simulator screen shot oct 21 2013 7 00 26 pm

Add new tag for Cocoapods support

Please add a new tag for the more recent commits past 1.0. The cocoapods spec is currently referencing the 1.0 tag and this version does not include iOS 6 fixes.

Cocoapods can reference the commits directly but the prefered method is access by tag.

Thanks!

DejalBezelActivityView appears on top of the view its not attached to when dismissing modal view with visible keyboard

I've got a view controller in my app that calculates some statistics. It does its job in the background, when it recieves certain NSNotifications. When NSNotification is received, it lays DejalBezelActivityView over its view, and when the job is done, dismisses it. So that's how it normally looks like:

01

I've got another controller (in the same UITabBarController) which can broadcast notifications when user adds an item to the database. The user can do that by filling data in modal view controller, which is basically a simple table view wich text fields.

03

The problem appears when the user hasn't dismissed the keyboard when filling the information. Modal view controller dismisses, presenting view controller sends NSNotification, and statistics view controller starts to calculate things. This is the moment when DejalBezelActivityView appears on top of unwanted view, although it shouldn't appear at all.

02

Interesting thing is, if the user dismisses the keyboard first and THEN presses "Save", this will not happen.

Showing new DejalActivityView during remove animation of the old one, prevents the new one from appearing

Because you are using singleton approach there is a problem when you quickly show DejalActivityView one after another (when old one is still animating to remove itself).

You are partially taking care of existing views during init:

if (dejalActivityView) [self removeView];

But the problem is that if there is removal animation still in progress, the completion selector will still be executed.

- (void)removeAnimationDidStop:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context

In that case finished parameter will be @(0) - since animation was cancelled, by removing a view from a superView. Without checking for that value this completion selector removes a new instance of a popup which you wanted to be visible.

You should be checking for the finished parameter value to prevent that.
Alternative will be checking:
if(dejalActivityView == self) in that method

Who's maintaining WTFeedbackView?

I read on your blog about Wagner Truppel's fork of your original DSActivityView and downloaded a copy because I needed the progress indicator feature. I believe I've identified a bug (not sure if it was introduced in Wagner's fork or if stems from DSActivityView), but can't seem to find an appropriate avenue through which to discuss it.

I think it's fairly obvious that you are only hosting it and not maintaining it, but I thought other folks with the same interest as mine might stumble upon this issue.

Custom Color of text/indicator

Is it possible to use cusom colors like green or UIColor for the text and indicator loader in DejalBezelActivityView ?

Activity view is not shown rotated

Hi,

I have a problem with orientation.
I am showing a view controller with horizontal orientation (no rotation is allowed on this view controller).

Here is how I make the horizontal view:

  • (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
    }

When the view is shown I am loading some list from remote server on the "viewDidLoad" method.
The activity view is shown in vertical orientation for some reason even though the view controller is horizontally oriented.
When I show the view second time (for example when creating a new item on the list), the view is shown properly.

Is it a known issue? Is there a solution?

Thanks,
Guy

Loading View Removed when ViewController loads

I have a view controller that on viewDidLoad calls the following method
[DejalBezelActivityView activityViewForView:self.view withLabel:@"Loading" width:0]

But after a few seconds it removes the activity view automatically without me removing it.

is there a chunk of dead code in DejalActivityView.m ?

Hi David

DejalActivityView is really useful. It looks like we are using a very old version. I.E. pre github. I was going through the code. I wanted to fix a couple of deprecated font related warnings.

seem like you use a style of code I am not familiar with.

prototype with a semi colen
chuck of code?

What does this do?

I noticed around line 300 what looks like a prototype and a chunk of code. I wonder if this dead code? I set a break point. It never seems to execute

- (void)layoutSubviews;
{
    self.frame = [self enclosingFrame];
    

I noticed something similar around line 569. a prototype and chunk of code. I know this chunk executes.

- (void)layoutSubviews;
{
    // If we're animating a transform, don't lay out now, as can't use the frame property when transforming:
    if (!CGAffineTransformIsIdentity(self.borderView.transform))
        return;
    
    self.frame = [self enclosingFrame];
    
    CGSize maxSize = CGSizeMake(260, 400);
    
    // https://stackoverflow.com/questions/19145078/ios-7-sizewithattributes-replacement-for-sizewithfontconstrainedtosize
//    CGSize textSize = [self.activityLabel.text sizeWithFont:
//                       [UIFont boldSystemFontOfSize:[UIFont systemFontSize]]
//                                          constrainedToSize:maxSize
//                                              lineBreakMode:self.activityLabel.lineBreakMode];
    //SCILog(@"deprecated textSiz: h:%f w:%f", textSize.height, textSize.width)
    NSDictionary *attributes = @{NSFontAttributeName: [UIFont boldSystemFontOfSize:[UIFont systemFontSize]]};
    CGRect rect = [self.activityLabel.text boundingRectWithSize:maxSize
                                                        options:NSStringDrawingUsesLineFragmentOrigin
                                                     attributes:attributes
                                                        context:nil];
    CGSize textSize = rect.size;
    //SCILog(@"deprecated textSiz: h:%f w:%f", textSize.height, textSize.width)

kind regards

Andy

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.