iphone弹出窗口效果的制作(Core animation, CALayer)
来源:互联网 发布:淘宝网不能加入购物车 编辑:程序博客网 时间:2024/06/01 07:25
效果类似人人网微薄客户端的弹出效果
staticCGFloat kTransitionDuration =0.3;
- (void)initView
{
UIWindow *window = [UIApplicationsharedApplication].keyWindow;
if (!window)
{
window = [[UIApplicationsharedApplication].windowsobjectAtIndex:0];
}
_backgroundView = [[UIViewalloc]initWithFrame:window.bounds];
// 这个可以使背景变成灰色,类似UIAlertView弹出的效果
_backgroundView.backgroundColor = [[UIColorblackColor]colorWithAlphaComponent:0.35];
//叠加到window上,这样他的父窗口就无法再响应点击消息了.
[windowaddSubview:_backgroundView];
self.frame =CGRectMake(10,60,300,380);
[_backgroundViewaddSubview:self];
self.backgroundColor = [UIColor orangeColor];
//一系列动画效果,先放大0.1,在缩小0.1,随后还原原始大小,达到反弹效果
self.transform = CGAffineTransformScale(CGAffineTransformIdentity,0.05,0.05);
[UIViewbeginAnimations:nilcontext:nil];
[UIViewsetAnimationDuration:kTransitionDuration/1.5];
[UIViewsetAnimationDelegate:self];
[UIViewsetAnimationDidStopSelector:@selector(bounceAnimationStopped)];
self.transform = CGAffineTransformScale(CGAffineTransformIdentity,1.1,1.1);
[UIViewcommitAnimations];
}
- (void)bounceAnimationStopped {
[UIViewbeginAnimations:nilcontext:nil];
[UIViewsetAnimationDuration:kTransitionDuration/2];
[UIViewsetAnimationDelegate:self];
[UIViewsetAnimationDidStopSelector:@selector(bounce2AnimationStopped)];
self.transform = CGAffineTransformScale(CGAffineTransformIdentity,0.9,0.9);
[UIViewcommitAnimations];
}
- (void)bounce2AnimationStopped {
[UIViewbeginAnimations:nilcontext:nil];
[UIViewsetAnimationDuration:kTransitionDuration/2];
self.transform = CGAffineTransformScale(CGAffineTransformIdentity,1.0,1.0);
[UIViewcommitAnimations];
}
CALayer *subLayer = [CALayerlayer];
subLayer.backgroundColor = [UIColorwhiteColor].CGColor;
subLayer.shadowOffset =CGSizeMake(0,10);
subLayer.shadowRadius =5.0;
subLayer.shadowColor = [UIColorblackColor].CGColor;
subLayer.shadowOpacity =0.8;
subLayer.frame =CGRectMake(30,30,150,190);
subLayer.cornerRadius =10;
subLayer.borderColor = [[UIColorblackColor]colorWithAlphaComponent:0.75].CGColor;
subLayer.borderWidth =4;
[self.layeraddSublayer:subLayer];
// 如果在层上添加的视图如图片比父视图大,应该试用maskToBounds = YES;
- iphone弹出窗口效果的制作(Core animation, CALayer)
- ios--弹出窗口效果的制作(Core animation, CALayer)
- CALayer 的简介 和Core Animation动画效果 A
- iPhone/iOS Core Animation开发总结(CALayer)
- iPhone/iOS Core Animation开发总结(CALayer)
- iPhone/iOS Core Animation开发总结(CALayer)
- iPhone/iOS Core Animation开发总结(CALayer)
- iPhone/iOS Core Animation开发总结(CALayer)
- iPhone/iOS Core Animation开发总结(CALayer)
- iPhone/iOS Core Animation开发总结(CALayer)
- core animation calayer的详解
- iphone 弹出效果制作
- UIView, CALayer,Core Animation
- Core Animation CALayer动画
- Core Animation 之 CALayer
- iPhone/iOS Core Animation开发总结(CALayer) 分类: iphone开发总结
- CALayer&Core Animation核心动画
- 17day-Core Animation&CALayer
- cs硕士妹子找工作经历【阿里人搜等互联网】
- 比较大小lisp程序
- Java swing绘图机制
- 关于回车换行符的显示和删除
- java格式化小数位
- iphone弹出窗口效果的制作(Core animation, CALayer)
- WLAN API应用介绍(含实例程序)
- C++ 虚函数与纯虚函数
- android ListView和GridView拖拽移位具体实现及拓展
- Linux内核源码分析方法
- Cocos-2d 关于多个CCSprite精灵播放同一个CCAction动画问题
- java并发编程5:实现锁无关数据结构
- 程序设计里的“小聪明”(1)
- 关于在app中直接打开其它网页