iOS封装了个可以自己消失的弹窗,类似安卓那种

https://github.com/ShrinkLynn/MBFadeAwayAlert
具体看demo吧,其实就是一个view加上动画

使用非常简单:

    MBFadeAlertView *alert = [[MBFadeAlertView alloc]init];
    
    /*
     
    //这里可以改参数
     
    alert.textFont           =   [UIFont systemFontOfSize:13.0f];
    alert.fadeWidth          =   200;
    alert.fadeBGColor        =   [UIColor colorWithRed:94.0/255.0f green:105.0/255.0f blue:107.0/255.0f alpha:1.0f];
    alert.titleColor         =   [UIColor whiteColor];
    alert.textOffWidth       =   18;
    alert.textOffHeight      =   8;
    alert.textBottomHeight   =   120;
    alert.fadeTime           =   1.5;
    alert.FadeBGAlpha        =   0.8;
     
     */
    
    [alert showAlertWith:self.textView.text];

如果想方便的用,就写个宏,放在常量头文件里:

///弹出提示框
#define alert(__MSG) \
{\
MBFadeAlertView *alert = [[MBFadeAlertView alloc]init];\
[alert showAlertWith:@__MSG];\
}

简书已经弃用,欢迎移步我的小专栏:
https://xiaozhuanlan.com/dahuihuiiOS

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容