日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

[翻译] AFDropdownNotification

發布時間:2025/3/15 编程问答 23 豆豆
生活随笔 收集整理的這篇文章主要介紹了 [翻译] 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

?

轉載于:https://www.cnblogs.com/YouXianMing/p/4258864.html

總結

以上是生活随笔為你收集整理的[翻译] AFDropdownNotification的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。