UIwindows 提示框动画显示以及隐藏关闭
来源:互联网 发布:网络语香菇是什么意思 编辑:程序博客网 时间:2024/05/22 14:32
最近做弹出相册选择等的弹出框,自己做了一个。互相学习一下。。。
直接上代码
@property (strong,nonatomic)UIWindow *windowButtonMineView;//悬浮
#pragma mark 修改图像响应方法
- (void)btnUserImageClick:(UIButton *)sender {
_windowButtonMineView = [[UIWindowalloc] initWithFrame:CGRectMake(0,self.view.frame.size.height,self.view.frame.size.width,140)];
_windowButtonMineView.windowLevel =UIWindowLevelAlert;
//_windowButton.backgroundColor = [UIColor colorWithRed:233 green:233 blue:233 alpha:1.0];
_windowButtonMineView.backgroundColor =ColorViewBackground;
float btnWidth =_windowButtonMineView.frame.size.width,btnHeigth =40;
UIButton *btnEditImage1 = [[UIButtonalloc] initWithFrame:CGRectMake(0,1, btnWidth, btnHeigth)];
[btnEditImage1 setTitle:@"拍照"forState:UIControlStateNormal];
[btnEditImage1 setTitleColor:ColorTextFondColorforState:UIControlStateNormal];
btnEditImage1.backgroundColor = [UIColorwhiteColor];
btnEditImage1.tag =2;
[btnEditImage1 addTarget:selfaction:@selector(btnImageBackClickInMineView:)forControlEvents:UIControlEventTouchUpInside];
[_windowButtonMineViewaddSubview:btnEditImage1];
UIButton *btnEditImage2 = [[UIButtonalloc] initWithFrame:CGRectMake(0,42, btnWidth, btnHeigth)];
[btnEditImage2 setTitle:@"从手机相册选择"forState:UIControlStateNormal];
[btnEditImage2 setTitleColor:ColorTextFondColorforState:UIControlStateNormal];
btnEditImage2.backgroundColor = [UIColorwhiteColor];
btnEditImage2.tag =1;
[btnEditImage2 addTarget:selfaction:@selector(btnImageBackClickInMineView:)forControlEvents:UIControlEventTouchUpInside];
[_windowButtonMineViewaddSubview:btnEditImage2];
UIButton *btnEditImage4 = [[UIButtonalloc] initWithFrame:CGRectMake(0,100, btnWidth, btnHeigth)];
btnEditImage4.backgroundColor = [UIColorwhiteColor];
[btnEditImage4 setTitle:@"取消"forState:UIControlStateNormal];
[btnEditImage4 setTitleColor:ColorTextFondColorforState:UIControlStateNormal];
[btnEditImage4 addTarget:selfaction:@selector(BtnCloseImageWindowsInMineView)forControlEvents:UIControlEventTouchUpInside];
[_windowButtonMineViewaddSubview:btnEditImage4];
//显示window
[_windowButtonMineViewmakeKeyAndVisible];
//设置动画的名字
[UIViewbeginAnimations:@"Animation"context:nil];
//设置动画的间隔时间
[UIViewsetAnimationDuration:0.50];
//??使用当前正在运行的状态开始下一段动画
[UIViewsetAnimationBeginsFromCurrentState: YES];
//设置视图移动的位移
_windowButtonMineView.frame =CGRectMake(0,self.view.frame.size.height-140,self.view.frame.size.width,140);
//设置动画结束
[UIViewcommitAnimations];
}
#pragma mark 关闭windows视图
-(void)BtnCloseImageWindowsInMineView{
//关闭UIwindow
[selfperformSelector:@selector(scale_1)withObject:nilafterDelay:0.0f];
[selfperformSelector:@selector(scale_2)withObject:nilafterDelay:0.5f];
}
//以下是启动页动画效果
-(void)scale_1
{
//设置动画的名字
[UIViewbeginAnimations:@"Animation"context:nil];
//设置动画的间隔时间
[UIViewsetAnimationDuration:0.50];
//??使用当前正在运行的状态开始下一段动画
[UIViewsetAnimationBeginsFromCurrentState: YES];
//设置视图移动的位移
_windowButtonMineView.frame =CGRectMake(0,self.view.frame.size.height,self.view.frame.size.width,140);
//设置动画结束
[UIViewcommitAnimations];
}
-(void)scale_2
{
//关闭UIwindow
_windowButtonMineView.hidden =YES;
[_windowButtonMineViewresignKeyWindow];
_windowButtonMineView =nil;
}
- UIwindows 提示框动画显示以及隐藏关闭
- 动画显示自定义提示框
- UIWindows
- jquery隐藏、显示、切换,滑动,淡入淡出,以及动画
- android 隐藏显示动画
- 隐藏显示动画案例
- bootstrap提示框的显示与隐藏
- Activity显示关闭动画
- 关闭web窗体不显示提示框
- 关闭、显示、隐藏某一个窗口
- Silverlight 显示隐藏动画效果
- 隐藏/显示界面动画效果
- jquery动画中显示、隐藏
- 动画的显示与隐藏
- jQuery动画-隐藏和显示
- 显示隐藏表格/ 连接提示
- Activity显示和关闭动画
- Mac显示/关闭显示 隐藏文件
- Windbg漏洞分析之CVE-2013-2551
- mysql 主从配置错误归纳
- Cent OS安装jdk(rpm方式)
- hr与lc的对比
- Win7上安装VS2015以后,VS2013崩溃
- UIwindows 提示框动画显示以及隐藏关闭
- 关于SVM一篇比较全介绍的博文(转)
- Tomcat 进程自动退出问题
- 粗看JavaScript经典指南(第一、二章)
- Java设计模式(17)行为型:责任链模式
- 十年工作总结
- jsonp
- 【洛谷P1197】[JSOI2008]星球大战 反向并查集+统计连通块
- PLSQL如何保存用户名和密码