iOS 仿安卓弹框 alertview
2016-06-22 15:13
375 查看
//弹框
-(void)animationWithStr:(NSString *)alertTitle{
self.alertLable = [[UILabel
alloc]initWithFrame:CGRectMake(kWidth/2 -
60, kHeight -
100, 120,
30)];
self.alertLable.backgroundColor
= [UIColor
colorWithHexString:@"#8d8a8a"
alpha:1];
self.alertLable.textColor = [UIColor
whiteColor];
self.alertLable.textAlignment
= NSTextAlignmentCenter;
self.alertLable.hidden =
NO;
self.alertLable.text = alertTitle;
self.alertLable.font
= [UIFont
systemFontOfSize:14];
self.alertLable.layer.masksToBounds
= YES;
self.alertLable.layer.cornerRadius
= 5;
[self.view
addSubview:self.alertLable];
[UIView
animateWithDuration:0.f
animations:^{
self.alertLable.alpha =1;
} completion:^(BOOL finished) {
[UIView
animateWithDuration:3.f
animations:^{
self.alertLable.alpha =
0;
} completion:^(BOOL finished) {
[self.alertLable
removeFromSuperview];
}];
}];
}
-(void)animationWithStr:(NSString *)alertTitle{
self.alertLable = [[UILabel
alloc]initWithFrame:CGRectMake(kWidth/2 -
60, kHeight -
100, 120,
30)];
self.alertLable.backgroundColor
= [UIColor
colorWithHexString:@"#8d8a8a"
alpha:1];
self.alertLable.textColor = [UIColor
whiteColor];
self.alertLable.textAlignment
= NSTextAlignmentCenter;
self.alertLable.hidden =
NO;
self.alertLable.text = alertTitle;
self.alertLable.font
= [UIFont
systemFontOfSize:14];
self.alertLable.layer.masksToBounds
= YES;
self.alertLable.layer.cornerRadius
= 5;
[self.view
addSubview:self.alertLable];
[UIView
animateWithDuration:0.f
animations:^{
self.alertLable.alpha =1;
} completion:^(BOOL finished) {
[UIView
animateWithDuration:3.f
animations:^{
self.alertLable.alpha =
0;
} completion:^(BOOL finished) {
[self.alertLable
removeFromSuperview];
}];
}];
}
相关文章推荐
- ios10测试版的真机在xcode8(beta)下编译报错 library not found for -lcrt1.3.1.o的解决办法
- iOS标签管理
- iOS 图片保存到本地相册
- iOS CocoaPods 的安装流程
- iOS 支付宝集成事项
- iOS RunLoop简介
- IOS之分析网易新闻存储数据(CoreData的使用,增删改查)
- ios的中文输入法无法触发onkeyup事件
- iOS识别二维码
- iOS设备保持屏幕常亮
- iOS 模态视图,视图之间的切换
- iostat 一些参数分析
- iOS开发中ViewController的页面跳转和弹出模态
- iOS-制作Framework
- 安装CocoaPods
- iOS 限制输入字数完美解决方案
- ios 多线程之NSThread篇举例详解
- iOS9新特性 3DTouch 开发教程全解(含源码)
- iOS GCD NSOperation NSThread等多线程各种举例详解
- 手动内存管理转ARC项目实战