[翻译] 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:
你可以直接將文件拖到你的項目當(dāng)中:
AFDropdownNotification.h AFDropdownNotification.mUsage - 使用
First of all, init your AFDropdownNotification class and set your main class asAFDropdownNotificationDelegate:
首先,進(jìn)入AFDropdownNotification這個類,設(shè)置你的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:
你可以設(shè)置titleText的屬性值,也可以設(shè)置subtitleText的屬性值,一個你可以控制是否顯示的圖片,以及兩個可選的按鈕,你可以分別設(shè)置這兩個按鈕的文本,例如:
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設(shè)置成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,你可以使用重力感應(yīng)的屬性(這個會包括一個彈跳的效果)或者是普通的UIKit動畫效果:
[notification presentInView:self.view withGravityAnimation:YES];Finally, to handle the buttons taps, implement the two methods defined by the delegate,?-dropdownNotificationTopButtonTapped?and?-dropdownNotificationBottomButtonTapped.
最后,為了能控制按鈕事件,實現(xiàn)下面的兩個代理方法即可.
-(void)dropdownNotificationTopButtonTapped {NSLog(@"Top button tapped"); }-(void)dropdownNotificationBottomButtonTapped { NSLog(@"Bottom button tapped"); }TODO - 待完成事項
- Light theme
- Autolayout support for rotation
License - 協(xié)議
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
?
轉(zhuǎn)載于:https://www.cnblogs.com/YouXianMing/p/4258864.html
總結(jié)
以上是生活随笔為你收集整理的[翻译] AFDropdownNotification的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: jquery ajax 参数可以序列化
- 下一篇: Install and run DB Q