Build Internet has a brand new theme, and that's only the beginning. Read the full story or hide this bar

YRDropdownView – A Polite UIAlertView Alternative for iOS

YRDropdownView is an iOS library for displaying stylish alerts, warnings, and errors

UIKit’s Shortcomings

From day one, iOS developers have been struggling to alert users about simple warnings and errors that may not interrupt the flow of the app. Popping up UIAlertViews requires the user to click a button to move along, which wasn’t quite necessary for warnings that merely limit useability. Adding a UILabel somewhere on the screen isn’t consistent and doesn’t always look great.

Maybe you just have some more information you want to inform your user about. Simply adding it to the screen is sufficient, but what if your information is added off screen? How does your user know it has appeared? TweetBot found a great solution to that. By overlaying a simple panel, with an icon, title, and message, the flow of the app is uninterrupted, yet informs the user in a concise manner.

Tweetbot Alert Example


Imitation Is The Greatest Form Of Flattery

YRDropdownView

YRDropdownView is a simple and versitile class that will increase the visibility of information relating to your app in a stylish way. YRDropdownView draws inspiration from such libraries like MKInfoPanel, MBProgressHUD, and DSActivityView and fills the gaps where these classes left off.

Usage

herever 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 manually in your code, 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;

+ (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;

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

Notes

Label and Background Customization

Currently, the title and detail labels, as well as the yellow background, are static for all dropdowns. Customizing these features are a TODO for this project.

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 compiler flag:

-fno-objc-arc

to all YRDropdownView files in your project.

Project on GitHub

For the cutting edge releases and outstanding issues, we’ve set up a GitHub repository to keep everything in order. Feel free to post any code related issues or contributions there in addition to in the comments below. We’ll also be doing minor releases there from time to time without making full blog posts. Enjoy!

Wordpress.com stats not installed! Posted Wednesday, February 1st, 2012 / Back to Top

I this post. Tweet
SPONSOR

38 Comments 5 Mentions

  1. 7OOOF.net Author Editor

    Well Done… Thanks

    February 2, 2012 · Reply

  2. kostas mouzakitis Author Editor

    Continue the good job :)

    February 19, 2012 · Reply

  3. fabir Author Editor

    very helpful thanks

    February 26, 2012 · Reply

  4. fabir Author Editor

    best web site ever…
    thanks man

    February 26, 2012 · Reply

  5. شات صوتي Author Editor

    You are great and thank for you articles

    March 6, 2012 · Reply

  6. Crane Boom Truck Author Editor

    this was so cool! i love your articles

    March 20, 2012 · Reply

  7. bdahfdsai Author Editor

    this was so cool! i love your articles

    May 6, 2012 · Reply

  8. clipping path service Author Editor

    Very useful article. You’ve done really excellent work. I’ll visit your blog again.

    June 5, 2012 · Reply

  9. Vilson Author Editor

    Why u guys use this auto-comment plugin? Boring to see it

    June 5, 2012 · Reply

  10. Acompanhantes brasilia Author Editor

    Very nice post I will use!

    June 11, 2012 · Reply

  11. phphunger Author Editor

    wow great work..i like it…

    June 22, 2012 · Reply

  12. nike air shox shoes Author Editor

    The important thing in life is to have a great aim , and the determination to attain it.

    July 24, 2012 · Reply

  13. acompanhantes brasilia Author Editor

    Thanks, I liked too much..

    September 23, 2012 · Reply

  14. Francisco Martins Author Editor

    Nice job! Can i use it with cocoapods?

    October 18, 2012 · Reply

  15. manjusavanth Author Editor

    wow grt job

    October 31, 2012 · Reply

  16. Daniel Torres Author Editor

    Very useful article. You’ve done really excellent work. I’ll visit your blog again.

    November 1, 2012 · Reply

  17. طراحی سایت Author Editor

    it was very insteresting
    tanx

    November 6, 2012 · Reply

  18. بهینه سازی سایت Author Editor

    gread job dude

    November 10, 2012 · Reply

  19. Zohaib Author Editor

    Very Nice tutorials…

    November 26, 2012 · Reply

  20. britanniainks Author Editor

    That is the most insane case i have ever seen!

    November 28, 2012 · Reply

  21. طراحی سایت Author Editor

    YRDropdownView – A Polite UIAlertView Alternative for iOS very good!!!! diiiiiiiiiiiiiii

    November 29, 2012 · Reply

  22. sonu sindhu Author Editor

    very nice
    I like it..

    December 3, 2012 · Reply

  23. app Author Editor

    wow great info thanks for sharing..

    January 22, 2013 · Reply

  24. fun pic Author Editor

    I found this is an educational and interesting publication, so I think it is very useful and knowledgeable. Thank you for the efforts you have made in writing this submission. I am hoping the analogous best work from you next time as well. practically your creative writing ability has inspired me.

    March 4, 2013 · Reply

  25. mahesh Author Editor

    From day one, iOS developers have been struggling to alert users about simple warnings and errors that may not interrupt the flow of the app.

    March 9, 2013 · Reply

  26. http://essayshelpers.co.uk/ Author Editor

    Great post, thanks for sharing!)

    March 19, 2013 · Reply

  27. http://bestessay4u.com/ Author Editor

    Many thanks to the person who made this post, this was very informative for me. Please continue this awesome work

    March 28, 2013 · Reply

  28. John Piechnick Author Editor

    I found this is an educational and interesting publication, so I think it is very useful and knowledgeable. Thank you for the efforts you have made in writing this submission. I am hoping the analogous best work from you next time as well. practically your creative writing ability has inspired me.

    April 6, 2013 · Reply

  29. Web Design Campbell Author Editor

    This kind of posts are encouraging and I prefer to read such quality content. Good effort great job.

    April 8, 2013 · Reply

  30. http://bestessaywriter.net/ Author Editor

    Wonderful story, reckoned we could combine a couple of unrelated information, nevertheless seriously really worth taking a search, whoa did one learn about Mid East has got much more problerms at the same time

    April 11, 2013 · Reply

  31. Sandra Smith Author Editor

    Ha ha . looks like developers have got some nice tool to glorify error message ..

    April 14, 2013 · Reply

  32. Tien Trinh Author Editor

    I think this is ACE! Keep sharing stuff like this please! :)

    April 18, 2013 · Reply

  33. ten mien Author Editor

    Thanks, I liked too much….

    April 22, 2013 · Reply

  34. bestessaysonly.com Author Editor

    I just want to tell you that I am all new to blogging and site-building and certainly loved you’re blog. Almost certainly I’m likely to bookmark your site . You actually come with very good writings. Thanks a bunch for revealing your website page.

    April 22, 2013 · Reply

  35. http://anyessay.co.uk/ Author Editor

    Your site amazing list of vectors, definitely a bookmark blog. Always good to have some inspiration and resources.

    April 25, 2013 · Reply

  36. http://essaymakers.co.uk/ Author Editor

    Useful info. Fortunate me I discovered your site unintentionally, and I_m shocked why this coincidence did not happened in advance! I bookmarked it.

    May 6, 2013 · Reply

  37. essay writing Author Editor

    I LOVE the idea. It is good stuff really like it! Thanks for sharing with us.

    May 22, 2013 · Reply

 

Join the Conversation

Back to Top / Comment RSS

2012 Build Internet. Created by One Mighty Roar. Icons by Komodo Media. Back to Top