Giter VIP home page Giter VIP logo

yrdropdownview's Introduction

YRDropdownView

Sample

YRDropdownView is a view library for displaying stylish alerts, warnings, and errors. Based on Tweetbot's implementation, MKInfoPanel by Mugunth Kumar, MBProgressHUD by Matej Bukovinski and DSActivityView by David Sinclair, among other influences. Its API has been hashed out to make the code easily implemented and very versatile.

Using YRDropdownView in your project?

Be sure to contact me and let me know, I'd love to give your app some promo love. See the Contact section below to let me know!

Installation

To use YRDropdownView:

  1. Copy over the YRDropdownView folder to your project folder. (Note: currently, the background is being drawn using a stretchable image, bg-yellow.png. Should you choose to supply your own background, you only need the YRDropdownView.h\.m files)
  2. Enjoy!

Usage

Wherever you want to use YRDropdownView, import the header file as follows:

#import "YRDropdownView.h"

Basic

You can create your dropdown by calling the singleton method:

[YRDropdownView showDropdownInView:self.view
                             title:@"Warning"
                            detail:@"Danger Will Robinson. You cannot do that."];

By default, calling the above method will only dismiss when clicked on. To dismiss, then call:

[YRDropdownView hideDropdownInView:self.view];

Customizing

There are many different ways to customize the alert by calling different singleton methods:

+ (YRDropdownView *)showDropdownInView:(UIView *)view
                                 title:(NSString *)title;

+ (YRDropdownView *)showDropdownInView:(UIView *)view
                                 title:(NSString *)title
                                detail:(NSString *)detail;

+ (YRDropdownView *)showDropdownInView:(UIView *)view
                                 title:(NSString *)title
                                detail:(NSString *)detail
                              animated:(BOOL)animated;

+ (YRDropdownView *)showDropdownInView:(UIView *)view
                                 title:(NSString *)title
                                detail:(NSString *)detail
                                 image:(UIImage *)image
                              animated:(BOOL)animated;

+ (YRDropdownView *)showDropdownInView:(UIView *)view
                                 title:(NSString *)title
                                detail:(NSString *)detail
                                 image:(UIImage *)image
                              animated:(BOOL)animated
                             hideAfter:(float)delay;
+ (YRDropdownView *)showDropdownInView:(UIView *)view
                                 title:(NSString *)title
                                detail:(NSString *)detail
                                 image:(UIImage *)image
                       backgroundImage:(UIImage *)backgroundImage
                              animated:(BOOL)animated
                             hideAfter:(float)delay;

+ (YRDropdownView *)showDropdownInView:(UIView *)view
                                 title:(NSString *)title
                                detail:(NSString *)detail
                                 image:(UIImage *)image
                       backgroundImage:(UIImage *)backgroundImage
                       titleLabelColor:(UIColor *)titleLabelColor
                      detailLabelColor:(UIColor *)detailLabelColor
                              animated:(BOOL)animated
                             hideAfter:(float)delay;

+ (BOOL)hideDropdownInView:(UIView *)view;
+ (BOOL)hideDropdownInView:(UIView *)view animated:(BOOL)animated;

+ (YRDropdownView *)showDropdownInWindow:(UIWindow *)window 
                                   title:(NSString *)title;

+ (YRDropdownView *)showDropdownInWindow:(UIWindow *)window 
                                   title:(NSString *)title
                                  detail:(NSString *)detail;

+ (YRDropdownView *)showDropdownInWindow:(UIWindow *)window 
                                   title:(NSString *)title
                                  detail:(NSString *)detail
                                animated:(BOOL)animated;

+ (YRDropdownView *)showDropdownInWindow:(UIWindow *)window 
                                   title:(NSString *)title
                                  detail:(NSString *)detail
                                   image:(UIImage *)image
                                animated:(BOOL)animated;

+ (YRDropdownView *)showDropdownInWindow:(UIWindow *)window 
                                   title:(NSString *)title
                                  detail:(NSString *)detail
                                   image:(UIImage *)image
                                animated:(BOOL)animated
                               hideAfter:(float)delay;

+ (YRDropdownView *)showDropdownInWindow:(UIWindow *)window 
                                   title:(NSString *)title
                                  detail:(NSString *)detail
                                   image:(UIImage *)image
                         backgroundImage:(UIImage *)backgroundImage
                                animated:(BOOL)animated
                               hideAfter:(float)delay;

+ (YRDropdownView *)showDropdownInWindow:(UIWindow *)window 
                                   title:(NSString *)title
                                  detail:(NSString *)detail
                                   image:(UIImage *)image
                         backgroundImage:(UIImage *)backgroundImage
                         titleLabelColor:(UIColor *)titleLabelColor
                        detailLabelColor:(UIColor *)detailLabelColor
                                animated:(BOOL)animated
                               hideAfter:(float)delay;

+ (BOOL)hideDropdownInWindow:(UIWindow *)window;
+ (BOOL)hideDropdownInWindow:(UIWindow *)window animated:(BOOL)animated;

Notes

Automatic Reference Counting (ARC) support

ARC support has been neglected in part for now. Your contributions are more than welcome, however. If you want to use YRDropdownView in an ARC project, just add the [add the

-fno-objc-arc

compiler flag](http://stackoverflow.com/questions/6646052/how-can-i-disable-arc-for-a-single-file-in-a-project) to all YRDropdownView files in your project.

Contact

License

MIT License

Copyright (c) 2012 One Mighty Roar (http://onemightyroar.com)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Bitdeli Badge

yrdropdownview's People

Contributors

alastairstuart avatar augustocallejas avatar bitdeli-chef avatar tonymillion 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

yrdropdownview's Issues

Crash

It crash as well in the example project, i honesty did not take a look why.

The drop down sometimes stop working...

It took me a really long time but I finally figured out why sometimes QA and end users would say that the drop-down wasn't working for them in my app sporadically.

Short-story:
If a drop-down was not dismissed in one tab of the tab bar controller ... we just had enough time to see it scroll down before we quickly switch to the other tab of the tab bar controller. Now if you try to get a drop-down to show, it won't work.

I am not an expert in this YRDropdownView project's code but I think it has something to do with the fact that in the following method:

+ (YRDropdownView *)showDropdownInView:(UIView *)view 
                         title:(NSString *)title 
                        detail:(NSString *)detail 
                         image:(UIImage *)image
                      animated:(BOOL)animated
                     hideAfter:(float)hideAfter

the current dropdown still has a non-nil value and we add the rest of the dropdowns to the queue ... behind something that will never get cleared out.

if (currentDropdown) // add to queue - [email protected]

can't hide after delay

Hi,

I am using YRDropdownView. When I show YRDropdownView any where in the view, it can hide automatically (with delay parameter set). But when YRDropdownView is triggered in a delegate function, it can't hide automatically.

Edited: To clarify the problem and give some suggestions:

I call YRDropdownView in a delegate function which is triggered when the background download is finished. The class in which it is called is in the mainthread. The problem is that it is called in a KVO function:

  • (void) observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object
    change:(NSDictionary *)change context:(void *)context

This is not in the mainthread. So performSelector: is not working here.

[dropdown performSelector:@selector(hideUsingAnimation:) withObject:[NSNumber numberWithBool:animated] afterDelay:delay+ANIMATION_DURATION];

Suggestion: also add a mainthread test here:

            if ([NSThread isMainThread]) {
                    //do something here

            } else {
                  //do something here
            }

iPad orientation

Hi,
there is a problem that occurs when you try to switch from portrait to landscape on ipad

iOS 7

I recently upgrade a project to iOS7 only to discover that the YRDropdownView appears behind the title bar. Do I need change my code in iOS7?

screen shot 2014-06-17 at 6 05 18 am

Thanks,
-Mark

@synthesize backgroundImage;

@synthesize backgroundImage;

Error:

//Existing ivar 'BackgroundImage' for unsafe_unretained propert 'backgroundImages' must be __unsafe_unretained.

@synthesize accessoryImage;

Error:
//Existing ivar 'accessoryImage' for unsafe_unretained property 'AccessoryImage' must ben __unsafe_unretained

iOS5

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.