iphone弹出窗口效果的制作(Core animation, CALayer)
效果类似人人网微薄客户端的弹出效果
static CGFloat kTransitionDuration = 0.3;
- (void)initView
{
UIWindow *window = [UIApplication sharedApplication].keyWindow;
if (!window)
{
window = [[UIApplication sharedApplication].windows objectAtIndex:];
} _backgroundView = [[UIView alloc] initWithFrame:window.bounds]; // 这个可以使背景变成灰色,类似UIAlertView弹出的效果
_backgroundView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.35]; // 叠加到window上,这样他的父窗口就无法再响应点击消息了.
[window addSubview:_backgroundView]; self.frame = CGRectMake(, , , );
[_backgroundView addSubview:self];
self.backgroundColor = [UIColor orangeColor]; // 一系列动画效果, 先放大0.1, 在缩小0.1,随后还原原始大小,达到反弹效果
self.transform = CGAffineTransformScale(CGAffineTransformIdentity, 0.05, 0.05);
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:kTransitionDuration/1.5];
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(bounceAnimationStopped)];
self.transform = CGAffineTransformScale(CGAffineTransformIdentity, 1.1, 1.1);
[UIView commitAnimations];
} - (void)bounceAnimationStopped {
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:kTransitionDuration/];
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(bounce2AnimationStopped)];
self.transform = CGAffineTransformScale(CGAffineTransformIdentity, 0.9, 0.9);
[UIView commitAnimations];
} - (void)bounce2AnimationStopped {
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:kTransitionDuration/];
self.transform = CGAffineTransformScale(CGAffineTransformIdentity, 1.0, 1.0);
[UIView commitAnimations];
}
如果想实现圆角的视图:
CALayer *subLayer = [CALayer layer];
subLayer.backgroundColor = [UIColor whiteColor].CGColor;
subLayer.shadowOffset = CGSizeMake(, );
subLayer.shadowRadius = 5.0;
subLayer.shadowColor = [UIColor blackColor].CGColor;
subLayer.shadowOpacity = 0.8;
subLayer.frame = CGRectMake(, , , );
subLayer.cornerRadius = ;
subLayer.borderColor = [[UIColor blackColor] colorWithAlphaComponent:0.75].CGColor;
subLayer.borderWidth = ;
[self.layer addSublayer:subLayer];
// 如果在层上添加的视图如图片比父视图大,应该试用maskToBounds = YES;
iphone弹出窗口效果的制作(Core animation, CALayer)的更多相关文章
- odoo-开发笔记 列表视图 增加记录弹出窗口效果
editable="bottom" 增加该标签的效果是,添加记录的时候,在原列表视图上一行一行添加; 去掉该标签之后,那么增加新记录的时候,会以弹出窗口的方式实现. 如果弹出的窗口 ...
- C#实现右下角弹出窗口效果
/// <summary> /// 窗体动画函数 注意:要引用System.Runtime.InteropServices; /// </summary> /// <pa ...
- C# winform 窗体从右下角向上弹出窗口效果
参考自 http://blog.csdn.net/yilan8002/article/details/7197981 /// <summary> /// 窗体动画函数 注意:要引用Syst ...
- Bootboxjs快速制作Bootstrap的弹出框效果
Bootboxjs是一个简单的js库,简单快捷帮你制作一个Bootstrap的弹出框效果. 一.简介 bootbox.js是一个小的JavaScript库,它帮助您在使用bootstrap框架的时候快 ...
- 使用movable-view制作可拖拽的微信小程序弹出层效果。
仿了潮汐睡眠小程序的代码.[如果有侵权联系删除 最近做的项目有个弹出层效果,类似音乐播放器那种.按照普通的做了一般感觉交互不是很优雅,设计妹子把潮汐睡眠的弹层给我看了看,感觉做的挺好,于是乘着有空仿照 ...
- [转]js来弹出窗口的详细说明
1.警告对话框 <script> alert("警告文字") </script> 2.确认对话框 <script> confirm(" ...
- 在HTML网页中设置弹出窗口的办法
[1.最基本的弹出窗口代码] 其实代码非常简单: <SCRIPT LANGUAGE="javascript"> <!-- window.open ('page.h ...
- JS弹出窗口代码大全(详细整理)
1.弹启一个全屏窗口 复制代码代码如下: <html> <body http://www.jb51.net','脚本之家','fullscreen');">; < ...
- EPUB弹出窗口式脚注
网上搜到一些国学典籍的EPUB版,虽有古人的注解,但正文和注解混排在一起,当我只想迅速读正文的时候比较碍眼.于是研究了一下 EPUB3 中有关脚注(footnote)的规格定义,写了一个 Python ...
随机推荐
- 十大要避免的Ext JS开发方法
原文地址:http://www.sencha.com/blog/top-10-ext-js-development-practices-to-avoid/ 作者:Sean LanktreeSean i ...
- Android设计 - 图标设计概述(Iconography)
2014-10-30 张云飞VIR 翻译自:https://developer.android.com/design/style/iconography.html Iconography 图标设计概述 ...
- PHP开发工程师-技能树
参考进阶-PHP程序员的技术成长规划-http://blog.csdn.net/heiyeshuwu/article/details/40098043 LNMP / LAMP 环境搭建(单组件安装,非 ...
- https://github.com/cobolfoo/gdx-skineditor
https://github.com/cobolfoo/gdx-skineditor A skin editor for libgdx 0.3
- SAP DBDI 网银接口实现案例
在财务共享中心SSC实施中,为了提高AP和对账的效率,不可避免的需要实现和网上银行的集成.笔者为各位分析该案例如下: 为什么要上网银? 2).和SAP的无缝集成 3).直接在SAP中和银联对接 4). ...
- 第三百四十三节,Python分布式爬虫打造搜索引擎Scrapy精讲—scrapy模拟登陆和知乎倒立文字验证码识别
第三百四十三节,Python分布式爬虫打造搜索引擎Scrapy精讲—scrapy模拟登陆和知乎倒立文字验证码识别 第一步.首先下载,大神者也的倒立文字验证码识别程序 下载地址:https://gith ...
- e861. 在两个组件之间共享输入映射和事件映射
By sharing an InputMap or ActionMap, any change to the shared InputMap or ActionMap will affect all ...
- Shell脚本中的export
shell 与 export命令 用户登录到Linux系统后,系统将启动一个用户shell.在这个shell中,可以使用shell命令 或声明变量,也可以创建并运行shell脚本程序.运行shell脚 ...
- 互联网公司GitHub repo 语言使用情况
转自: https://laike9m.com/blog/hu-lian-wang-gong-si-github-repo-yu-yan-shi-yong-qing-kuang,56/ 现在基本上所有 ...
- 转载:AOP那点事
原作者:黄勇 博客地址:https://my.oschina.net/huangyong/blog/161338 又是一个周末,刚给宝宝喂完牛奶,终于让她睡着了.所以现在我才能腾出手来,坐在电脑面前给 ...