iOS升级页面弹框
来源:互联网 发布:mac鼠标指针变大 编辑:程序博客网 时间:2024/05/01 11:09
UIWindow *window = [UIApplicationsharedApplication].keyWindow;
//1.创建一个大View 蒙版 (加在谁的身上)
UIView *dimView = [[UIViewalloc]initWithFrame:kScreenBounds];
dimView.backgroundColor = [UIColorblackColor];
dimView.alpha =0.4;
[window addSubview:dimView];
//2.在蒙版里面放一张 imageView
UIImageView *imageView = [[UIImageViewalloc]initWithImage:[UIImageimageNamed:@"bg"]];
//开启用户交互
imageView.userInteractionEnabled =YES;
imageView.center = window.center;
[window addSubview:imageView];
//3.在imageView里面放一个按钮
UIButton *btn = [[UIButtonalloc]init];
UIImage *image = [UIImageimageNamed: @"close1"];
[btn setImage:imageforState:UIControlStateNormal];
btn.frame =CGRectMake(imageView.bounds.size.width - image.size.width-30,80, image.size.width, image.size.height);
[imageView addSubview:btn];
//4.监听按钮
[btn addTarget:selfaction:@selector(cancel:)forControlEvents:UIControlEventTouchUpInside];
//5.添加更新文字
UILabel* updateTitle = [[UILabelalloc]initWithFrame:CGRectMake(imageView.bounds.size.width/2.0-90,163, 180,30)];
// updateTitle.backgroundColor = [UIColor greenColor];
updateTitle.text =@"软件更新提示";
updateTitle.textAlignment =NSTextAlignmentCenter;
updateTitle.textColor =LColor(246,45, 45);
[imageView addSubview:updateTitle];
UITextView* updateText = [[UITextViewalloc]initWithFrame:CGRectMake(imageView.bounds.size.width/2.0-80,190, 180,100)];
updateText.backgroundColor = [UIColorwhiteColor];
updateText.editable =NO;
updateText.text = messageStr;
NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStylealloc] init];
paragraphStyle.lineSpacing =3; //行距
NSDictionary *attributes =@{ NSFontAttributeName:[UIFontsystemFontOfSize:15],NSParagraphStyleAttributeName:paragraphStyle,NSForegroundColorAttributeName:LColor(137,137, 137)};
updateText.attributedText = [[NSAttributedStringalloc]initWithString: updateText.textattributes:attributes];
[imageView addSubview:updateText];
// UIButton* updateNowBtn = [[UIButton alloc]initWithFrame:CGRectMake(imageView.bounds.size.width/2.0-60, 300, 120, 30)];
UIButton* updateNowBtn = [UIButtonbuttonWithType:UIButtonTypeCustom];
updateNowBtn.layer.cornerRadius =3;
updateNowBtn.frame =CGRectMake(imageView.bounds.size.width/2.0-60,303, 120,30);
// updateNowBtn.clipsToBounds = YES;
updateNowBtn.backgroundColor =LColor(246,45, 45);
[updateNowBtn setTitle:@"立即更新"forState:UIControlStateNormal];
[updateNowBtn addTarget:selfaction:@selector(nowUpdata)forControlEvents:UIControlEventTouchUpInside];
[updateNowBtn setTitleColor:LColor(255,255, 255)forState:UIControlStateNormal];
[imageView addSubview:updateNowBtn];
//关联
_dimView = dimView;
_imageView = imageView;
-(void)cancel:(uibutton*)btn{
[UIViewanimateWithDuration:0.5animations:^{
_imageView.alpha =0.1;
_dimView.alpha =0.1;
} completion:^(BOOL finished) {
[UIViewanimateWithDuration:0.5animations:^{
[_imageViewremoveFromSuperview];
[_dimViewremoveFromSuperview];
}];
}];
}
- iOS升级页面弹框
- ios升级
- Cisco 交换机 升级 IOS
- PIX515升级IOS
- ios-版本升级检测
- CISCO 3560 升级IOS
- ios开发 升级App
- ios升级app
- iOS 数据库升级
- IOS 版本升级思路
- cordova ios升级插件
- IOS 版本升级提示
- iOS 数据库升级策略
- iOS数据库升级步骤
- 思科交换机IOS升级
- iOS APP升级版本
- iOS 版本升级
- ios升级https记录
- 操作File文件的一些基本打包函数
- InvokeRepeating()函数的使用
- Xcode8输出台
- HDU 5929 Basic Data Structure 【模拟】 (2016CCPC东北地区大学生程序设计竞赛)
- 关于本地存储的那些事
- iOS升级页面弹框
- React-Native 获取屏幕尺寸
- 四种方案解决ScrollView嵌套ListView问题
- windos 文件传到linux中^M如何转换成linux中换行
- 【MySQL】基于MySQL的SQL优化(五)——建立索引优化SQL
- adb抓取log
- git冲突解决
- UVA 11235 Frequent values(RMQ)
- Objective-C学习之 NSDate简单使用说明