bl双性强迫侵犯h_国产在线观看人成激情视频_蜜芽188_被诱拐的少孩全彩啪啪漫画

FFToast:GitHub中最強大的iOSNotification和AlertView框架,沒有之一!

FFToast:GitHub中最強大的iOS Notification和AlertView框架,沒有之一!

創新互聯主要從事成都做網站、成都網站設計、網頁設計、企業做網站、公司建網站等業務。立足成都服務東洲,十年網站建設經驗,價格優惠、服務專業,歡迎來電咨詢建站服務:18982081108


FFToast是一個非常強大的iOS message notifications和AlertView擴展。它可以很容易實現從屏幕頂部、屏幕底部和屏幕中間彈出一個通知。你可以很容易的自定義彈出的View.


GitHub鏈接:https://github.com/imlifengfeng/FFToast

要求

  • 支持iOS 8或更高版本

  • 支持ARC

特點

  • 簡單易用

  • 可以很容易自定義

安裝

CocoaPods

要使用CocoaPods安裝FFToast,請將其集成到您現有的Podfile中,或創建一個新的Podfile:

target 'MyApp' do
  pod 'FFToast'end

然后 pod install.

手動

將FFToast文件夾添加到項目中

使用方法

#import <FFToast/FFToast.h>

你可以通過調用下面的方法創建一個顯示在頂部的默認效果的消息通知:

/**
 創建并顯示一個Toast @param title 標題 @param message 消息內容 @param iconImage 消息icon,toastType不為FFToastTypeDefault時iconImage為空仍然會有相應icon @param duration 顯示時長
 */+ (void)showToastWithTitle:(NSString *)title message:(NSString *)message iconImage:(UIImage*)iconImage duration:(NSTimeInterval)duration toastType:(FFToastType)toastType;

其中的toastType:

typedef NS_ENUM(NSInteger, FFToastType) {

    //灰色背景、無圖標    FFToastTypeDefault = 0,
    //綠色背景+成功圖標    FFToastTypeSuccess = 1,
    //紅色背景+錯誤圖標    FFToastTypeError = 2,
    //橙色背景+警告圖標    FFToastTypeWarning = 3,
    //灰藍色背景+信息圖標    FFToastTypeInfo = 4,

};

例如:

[FFToast showToastWithTitle:@"標題" message:@"消息內容......." iconImage:[UIImage p_w_picpathNamed:@"test"] duration:3 toastType:FFToastTypeDefault];

標題(title)、消息內容(message)、圖標(iconImage)均可以為nil,FFToast會根據具體的內容進行自適應。

如果想在狀態欄下方、屏幕下方或者屏幕中間顯示消息通知,可以通過設置一些屬性實現。
設置顯示位置:

typedef NS_ENUM(NSInteger, FFToastPosition) {    //顯示在屏幕頂部
    FFToastPositionDefault = 0,    //顯示在狀態欄下方
    FFToastPositionBelowStatusBar = 1,    //顯示在狀態欄下方+圓角+左右邊距
    FFToastPositionBelowStatusBarWithFillet = 2,    //顯示在屏幕底部
    FFToastPositionBottom = 3,    //顯示在屏幕底部+圓角
    FFToastPositionBottomWithFillet = 4,    //顯示在屏幕中間
    FFToastPositionCentre = 5,    //顯示在屏幕中間+圓角
    FFToastPositionCentreWithFillet = 6};

其他的一些屬性:

//背景顏色@property (strong, nonatomic) UIColor* toastBackgroundColor;//Toast標題文字顏色@property (strong, nonatomic) UIColor* titleTextColor;//Toast內容文字顏色@property (strong, nonatomic) UIColor* messageTextColor;//Toast標題文字字體@property (strong, nonatomic) UIFont* titleFont;//Toast文字字體@property (strong, nonatomic) UIFont* messageFont;//Toast View圓角@property(assign,nonatomic)CGFloat toastCornerRadius;//Toast View透明度@property(assign,nonatomic)CGFloat toastAlpha;//Toast顯示時長@property(assign,nonatomic)NSTimeInterval duration;//Toast消失動畫是否啟用@property(assign,nonatomic)BOOL dismissToastAnimated;//Toast顯示位置@property (assign, nonatomic) FFToastPosition toastPosition;//Toast顯示類型@property (assign, nonatomic) FFToastType toastType;//是否自動隱藏,autoDismiss、enableDismissBtn、dismissBtnImage三個屬性僅對從屏幕中間彈出的Toast有效@property(assign,nonatomic)BOOL autoDismiss;//是否在右上角顯示隱藏按鈕@property(assign,nonatomic)BOOL enableDismissBtn;//隱藏按鈕的圖標@property (strong, nonatomic) UIImage* dismissBtnImage;

設置完屬性后,就可以調用下面方法將其顯示出來:

/**
 顯示一個Toast
 */- (void)show;

或者:

/**
 顯示一個Toast

 @param handler Toast點擊回調
 */- (void)show:(handler)handler;

例如:

FFToast *toast = [[FFToast alloc]initToastWithTitle:@"標題" message:@"消息內容......." iconImage:[UIImage p_w_picpathNamed:@"fftoast_info"]];
toast.toastPosition = FFToastPositionBelowStatusBarWithFillet;
toast.toastBackgroundColor = [UIColor colorWithRed:75.f/255.f green:107.f/255.f blue:122.f/255.f alpha:1.f];
[toast show:^{    //點擊消息通知時調用}];//[toast show];

如果你想自定義一個從中間彈出的Toast,可以調用下面的方法:

/**
 在中間顯示一個自定義Toast

 @param customToastView 自定義的ToastView
 @param autoDismiss 是否自動隱藏
 @param duration 顯示時長(autoDismiss = NO時該參數將無效)
 @param enableDismissBtn 是否顯示隱藏按鈕
 @param dismissBtnImage 隱藏按鈕圖片(enableDismissBtn = NO時該參數將無效)
 @return Toast
 */
- (instancetype)initCentreToastWithView:(UIView *)customToastView autoDismiss:(BOOL)autoDismiss duration:(NSTimeInterval)duration enableDismissBtn:(BOOL)enableDismissBtn dismissBtnImage:(UIImage*)dismissBtnImage;

你在自定義從中間彈出的Toast時,你可以將上面的參數autoDismiss和參數enableDismissBtn設為NO。然后在你自定義的View中自己在合適的位置添加一個關閉按鈕。
關閉從中間彈出的Toast,可以調用下面的方法:

/**
 隱藏一個Toast
 */- (void)dismissCentreToast;

頂部、底部彈出的Toast不可自定義View,但是對于iconImage、Title、message均可以根據需要設置并且可以為nil,最終Toast會根據具體的內容進行自適應。

隱藏消息通知:
默認3秒后自動消失,向上滑動彈出的消息通知它也會消失。

關于

作者:
imlifengfeng
微博:
@imlifengfeng

許可

該項目在 MIT 許可協議下使用. 有關詳細信息,請參閱 LICENSE.

文章題目:FFToast:GitHub中最強大的iOSNotification和AlertView框架,沒有之一!
當前網址:http://vcdvsql.cn/article10/iighgo.html

成都網站建設公司_創新互聯,為您提供動態網站響應式網站建站公司品牌網站設計網站策劃網站導航

廣告

聲明:本網站發布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源: 創新互聯

搜索引擎優化