效果类似人人网微薄客户端的弹出效果

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)的更多相关文章

  1. odoo-开发笔记 列表视图 增加记录弹出窗口效果

    editable="bottom" 增加该标签的效果是,添加记录的时候,在原列表视图上一行一行添加; 去掉该标签之后,那么增加新记录的时候,会以弹出窗口的方式实现. 如果弹出的窗口 ...

  2. C#实现右下角弹出窗口效果

    /// <summary> /// 窗体动画函数 注意:要引用System.Runtime.InteropServices; /// </summary> /// <pa ...

  3. C# winform 窗体从右下角向上弹出窗口效果

    参考自 http://blog.csdn.net/yilan8002/article/details/7197981 /// <summary> /// 窗体动画函数 注意:要引用Syst ...

  4. Bootboxjs快速制作Bootstrap的弹出框效果

    Bootboxjs是一个简单的js库,简单快捷帮你制作一个Bootstrap的弹出框效果. 一.简介 bootbox.js是一个小的JavaScript库,它帮助您在使用bootstrap框架的时候快 ...

  5. 使用movable-view制作可拖拽的微信小程序弹出层效果。

    仿了潮汐睡眠小程序的代码.[如果有侵权联系删除 最近做的项目有个弹出层效果,类似音乐播放器那种.按照普通的做了一般感觉交互不是很优雅,设计妹子把潮汐睡眠的弹层给我看了看,感觉做的挺好,于是乘着有空仿照 ...

  6. [转]js来弹出窗口的详细说明

    1.警告对话框 <script> alert("警告文字") </script> 2.确认对话框 <script> confirm(" ...

  7. 在HTML网页中设置弹出窗口的办法

    [1.最基本的弹出窗口代码] 其实代码非常简单: <SCRIPT LANGUAGE="javascript"> <!-- window.open ('page.h ...

  8. JS弹出窗口代码大全(详细整理)

    1.弹启一个全屏窗口 复制代码代码如下: <html> <body http://www.jb51.net','脚本之家','fullscreen');">; < ...

  9. EPUB弹出窗口式脚注

    网上搜到一些国学典籍的EPUB版,虽有古人的注解,但正文和注解混排在一起,当我只想迅速读正文的时候比较碍眼.于是研究了一下 EPUB3 中有关脚注(footnote)的规格定义,写了一个 Python ...

随机推荐

  1. zookeeper快照清理

    从3.4版本以后,在配置文件中有2个参数分别设置快照的清理.默认没有打开. autopurge.purgeInterval=1 这个参数指定了清理频率,单位是小时,需要填写一个1或更大的整数,默认是0 ...

  2. 【jquery】jquery 自定义滚动条

    可以自由的给滚动条定义背景,上下按钮,当然不仅仅是颜色,连图片当背景也可以.支持鼠标滚轮,点击滚动条滚轴定位,上下按钮久按加速,兼容 ie,firefox,chrome. 调用方法: $(" ...

  3. java File linux windows 下 绝对路径 相对路径问题

    前言 当前项目目录 windows 为  E:\project\testpro\ linux 为  /project/testpro/ Windows环境下获取绝对路径情况 使用 a/b/c 为路径, ...

  4. 解决:No qualifying bean of type [org.springframework.jdbc.core.JdbcTemplate] found for dependency

    错误: Description: Field jdbcTemplate in com.gwd.dao.impl.IUserDaoImpl required a bean of type 'org.sp ...

  5. SSM Spring +SpringMVC+Mybatis 整合配置 及pom.xml

    SSM Spring +SpringMVC+Mybatis 配置 及pom.xml SSM框架(spring+springMVC+Mybatis) pom.xml文件 maven下的ssm整合配置步骤

  6. PCL点云特征描述与提取(3)

    快速点特征直方图(FPFH)描述子 已知点云P中有n个点,那么它的点特征直方图(PFH)的理论计算复杂度是,其中k是点云P中每个点p计算特征向量时考虑的邻域数量.对于实时应用或接近实时应用中,密集点云 ...

  7. R语言合并data.frame

    Merging Data Adding Columns To merge two data frames (datasets) horizontally,  use the merge functio ...

  8. 【转】如果有人让你推荐Python技术书,请让他看这个列表

    入门级 <Head First Python>+ 入门级 + 微信49票 + 豆瓣评分 9.5 推荐语: 66:浅显易懂,编排的顺序特别,有大量插图.对话,不感觉枯燥 古心:通熟易懂,配有 ...

  9. Android的线程使用来更新UI----Thread、Handler、Looper、TimerTask等

    方法一:(java习惯,在android不推荐使用) 刚刚开始接触android线程编程的时候,习惯好像java一样,试图用下面的代码解决问题 new Thread( new Runnable() { ...

  10. [转]浅谈Android五大布局(一)——LinearLayout、FrameLayout和AbsoulteLayout

    Android的界面是有布局和组件协同完成的,布局好比是建筑里的框架,而组件则相当于建筑里的砖瓦.组件按照布局的要求依次排列,就组成了用户所看见的界面.Android的五大布局分别是LinearLay ...