zoukankan      html  css  js  c++  java
  • [翻译] AFDropdownNotification

    AFDropdownNotification

    Dropdown notification view for iOS.

    下拉通知的view,用于iOS.

     

    Installation - 安装

    If you're using CocoaPods, just add this line to your Podfile:

    如果你正在使用CocoaPods,只要加这么一句话到Podfile中即可:

    pod 'AFDropdownNotification', '~> 1.0'
    

    If you're not, import these files to your project:

    你可以直接将文件拖到你的项目当中:

    AFDropdownNotification.h
    AFDropdownNotification.m
    

    Usage - 使用

    First of all, init your AFDropdownNotification class and set your main class asAFDropdownNotificationDelegate:

    首先,进入AFDropdownNotification这个类,设置你的asAFDropdownNotificationDelegate的代理方法:

    AFDropdownNotification *notification = [[AFDropdownNotification alloc] init];
    notification.notificationDelegate = self;

    You can configure the title text with the titleText property, the subtitle text with subtitleText, an optional left image defined as image, and two optional buttons, with topButtonText andbottomButtonText. For example:

    你可以设置titleText的属性值,也可以设置subtitleText的属性值,一个你可以控制是否显示的图片,以及两个可选的按钮,你可以分别设置这两个按钮的文本,例如:

    notification.titleText = @"Update available";
    notification.subtitleText = @"Do you want to download the update of this file?";
    notification.image = [UIImage imageNamed:@"update"];
    notification.topButtonText = @"Accept";
    notification.bottomButtonText = @"Cancel";

    If you want to hide the notification by tapping it, set dimissOnTap to YES:

    如果你想在点击了通知后隐藏掉通知,你只需要将dimissOnTap设置成YES即可:

    notification.dismissOnTap = YES;

    To present it, you can choose if you want to use UIKit dynamics (which will include a subtle bounce) or a regular lineal UIKit animation:

    为了要显示出通知的view,你可以使用重力感应的属性(这个会包括一个弹跳的效果)或者是普通的UIKit动画效果:

    [notification presentInView:self.view withGravityAnimation:YES];

    Finally, to handle the buttons taps, implement the two methods defined by the delegate, -dropdownNotificationTopButtonTapped and -dropdownNotificationBottomButtonTapped.

    最后,为了能控制按钮事件,实现下面的两个代理方法即可.

    -(void)dropdownNotificationTopButtonTapped {
    
        NSLog(@"Top button tapped");
    }
    
    -(void)dropdownNotificationBottomButtonTapped {
    
        NSLog(@"Bottom button tapped");
    }

    TODO - 待完成事项

    • Light theme
    • Autolayout support for rotation

    License - 协议

    AFDropdownNotification is under MIT license so feel free to use it!

    Author - 作者

    Made by Alvaro Franco. If you have any question, feel free to drop me a line atalvarofrancoayala@gmail.com

  • 相关阅读:
    BOM
    no response from Graphic Screen Painter Exiting
    Windows Mobile 中模拟按键
    C# 获取汉字拼音首字母
    Web Service介绍
    .net/c#中栈和堆的区别及代码在栈和堆中的执行流程详解
    使用JSON加速AJAX(By Sean Kelly)
    Sql字符串操作函数
    一个简单AJAX注册示例
    .Net平台开发的技术规范与实践精华总结
  • 原文地址:https://www.cnblogs.com/YouXianMing/p/4258864.html
Copyright © 2011-2022 走看看