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
直接將源碼拖到你的項目當中便可