iOS封装了个可以自己消失的弹窗,类似安卓那种
2015-03-26 本文已影响1115人
大灰灰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