• [翻译] JFMinimalNotifications


    JFMinimalNotifications

    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+.

    这是一个iOS的view,用以呈现非常漂亮的通知信息,高度定制,可以同时用于iPhone和iPad。JFMinimalNotification只支持ARC,iOS7.0以上。

    What It Looks Like: 它看起来像这样子:

    See a short video of this control here: https://www.youtube.com/watch?v=jDYC-NYKl9A

    你可以在这个地方观看演示视频https://www.youtube.com/watch?v=jDYC-NYKl9A

    Screen Shots 截图

    How To Use It: 这么用:

    Basic Example

    基本用法

    - (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];
    }

    Constructors / Options

    构造器 / 选项

    /**
     * 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.

    你可以参考示例项目来看看怎么使用这个通知的控件。

    Delegate Methods: 代理方法

    - (void)willShowNotification:(JFMinimalNotification*)notification;
    - (void)didShowNotification:(JFMinimalNotification*)notification;
    - (void)willDisimissNotification:(JFMinimalNotification*)notification;
    - (void)didDismissNotification:(JFMinimalNotification*)notification;
    

    Installation: 安装

    Cocoapods Cocoapods安装

    pod 'JFMinimalNotifications', '~> 0.0.2'

    Directly include source into your projects

    直接将源码拖到你的项目当中即可

    • Simply copy the source files from the "JFMinimalNotification" folder into your project. 你只需要简单的将JFMinimalNotification文件夹拖到你的项目当中
    • In your application's project app target settings, find the "Build Phases" section and open the "Link Binary With Libraries" block and click the "+" button and select the "CoreGraphics.framework". 在你的工程项目当中,找到Build Phases区,打开Link Binary With Libraries,点击+按钮,然后选择CoreGraphics.framework框架

     

  • 相关阅读:
    2020软件工程个人作业06——软件工程实践总结作业
    git上传文件夹内容
    git常用命令(部分)
    java命令行输入参数
    2020软件工程作业05
    软件工程——问题清单
    2020软件工程作业04
    2020软件工程作业03
    2020软件工程作业02
    问题清单
  • 原文地址:https://www.cnblogs.com/YouXianMing/p/4194689.html
Copyright © 2020-2023  润新知