JFMinimalNotificationsgit
This is an iOS UIView for presenting a beautiful notification that is highly configurable and works for both iPhone and iPad. JFMinimalNotification is only available in ARC and targets iOS 7.0+.github
这是一个iOS的view,用以呈现很是漂亮的通知信息,高度定制,能够同时用于iPhone和iPad。JFMinimalNotification只支持ARC,iOS7.0以上。objective-c
What It Looks Like: 它看起来像这样子:app
See a short video of this control here: https://www.youtube.com/watch?v=jDYC-NYKl9A框架
你能够在这个地方观看演示视频https://www.youtube.com/watch?v=jDYC-NYKl9Aide
Screen Shots 截图ui
How To Use It: 这么用:this
基本用法代理
- (void)viewDidLoad
{
[super viewDidLoad]; /** * Create the notification */ self.minimalNotification = [JFMinimalNotification notificationWithStyle:JFMinimalNotificationStyleDefault title:@"This is my awesome title" subTitle:@"This is my awesome sub-title"]; /** * Set the desired font for the title and sub-title labels * Default is System Normal */ UIFont* titleFont = [UIFont fontWithName:@"STHeitiK-Light" size:22]; [self.minimalNotification setTitleFont:titleFont]; UIFont* subTitleFont = [UIFont fontWithName:@"STHeitiK-Light" size:16]; [self.minimalNotification setSubTitleFont:subTitleFont]; /** * Add the notification to a view */ [self.view addSubview:self.minimalNotification]; } /** * Showing the notification from a button handler */ - (IBAction)show:(id)sender { [self.minimalNotification show]; } /** * Hiding the notification from a button handler */ - (IBAction)dismiss:(id)sender { [self.minimalNotification dismiss]; }
构造器 / 选项
/**
* Note: passing a dismissalDelay of 0 means the notification will NOT be automatically dismissed, you will need to * dismiss the notification yourself by calling -dismiss on the notification object. If you pass a dismissalDelay * value greater than 0, this will be the length of time the notification will remain visisble before being * automatically dismissed. */ // With dismissalDelay self.minimalNotification = [JFMinimalNotification notificationWithStyle:JFMinimalNotificationStyleError title:@"This is my awesome title" subTitle:@"This is my awesome sub-title" dismissalDelay:3.0]; // Without dismissalDelay and with touchHandler self.minimalNotification = [JFMinimalNotification notificationWithStyle:JFMinimalNotificationStyleError title:@"This is my awesome title" subTitle:@"This is my awesome sub-title" dismissalDelay:0.0 touchHandler:^{ [self.minimalNotification dismiss]; }];
// Available Styles
typedef NS_ENUM(NSInteger, JFMinimalNotificationStytle) { JFMinimalNotificationStyleDefault, JFMinimalNotificationStyleError, JFMinimalNotificationStyleSuccess, JFMinimalNotificationStyleInfo, JFMinimalNotificationStyleWarning };
Please see the example project include in this repo for an example of how to use this notification.
你能够参考示例项目来看看怎么使用这个通知的控件。
- (void)willShowNotification:(JFMinimalNotification*)notification; - (void)didShowNotification:(JFMinimalNotification*)notification; - (void)willDisimissNotification:(JFMinimalNotification*)notification; - (void)didDismissNotification:(JFMinimalNotification*)notification;
pod 'JFMinimalNotifications', '~> 0.0.2'
Directly include source into your projects
直接将源码拖到你的项目当中便可