YRDropdownView is an iOS library for displaying stylish alerts, warnings, and errors
UIKitâs ShortcomingsFrom 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.
Imitation Is The Greatest Form Of FlatteryYRDropdownView 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.
Usageherever you want to use YRDropdownView, import the header file as follows:
#import "YRDropdownView.h" BasicYou 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]; CustomizingThere 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 CustomizationCurrently, 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) supportARC 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-arcto all YRDropdownView files in your project.
Project on GitHubFor 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!
Powered By WizardRSS.com | Full Text RSS Feed | Amazon Store Builder | Android Games | Wordpress Tutorials