[翻译] 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.mUsage - 使用
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
转载于:https://www.cnblogs.com/YouXianMing/p/4258864.html
总结
以上是生活随笔为你收集整理的[翻译] AFDropdownNotification的全部内容,希望文章能够帮你解决所遇到的问题。
- 上一篇: jquery ajax 参数可以序列化
- 下一篇: BZOJ 2005: [Noi2010]