在应用开发中总要用到加载数据时候的loading动画效果 以下为一个loading效果实例,可以直接拿去用的:
在你的xxxController 头文件中声明: UIView *colorView;
UIActivityIndicatorView *aciv;
初始化中定义: aciv = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray]; colorView=[[UIView alloc]initWithFrame:CGRectMake(0, 0, screenWidth, screenHeight)];
[colorView setBackgroundColor:[UIColor colorWithRed:0.2 green:0.2 blue:0.2 alpha:0.4]];
加入以下方法:
- (void)addLoading{
aciv.activityIndicatorViewStyle=UIActivityIndicatorViewStyleWhite;
aciv.center=CGPointMake(screenWidth/2,screenHeight/2-10);
[self.view addSubview:colorView];
[aciv startAnimating];
[self.view addSubview:aciv];
}
- (void)removeLoading{
[colorView removeFromSuperview];
[aciv stopAnimating];
[aciv removeFromSuperview];
}
注释掉 //[self.view addSubview:colorView];
//[colorView removeFromSuperview];
则动画没有灰色背景 界面切换则可以有很多效果,如淡入淡出,放大,雾化,翻转等。 淡入淡出:
- (void)animateEaseInEaseOut:(CALayer*)laye delegate:(id)del{
CATransition *animationA = [CATransition animation];
[animationA setType:kCATransitionFade];
[animationA setDuration:1];
[animationA setDelegate:del];
[animationA setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]]; [laye addAnimation:animationA forKey:@"EaseInEaseOut"];
}
翻转:
- (void)animateFlipView{
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:1];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:self.view cache:YES];
[UIView commitAnimations];
}
分享到:
相关推荐
用animation实现UIView动画效果,简单上中下移动
iphone图片切换效果
各种动画实例,方便开发,可以直接看效果。
Sample Code,演示了iphone支持的动画效果。包含翻转、淡出、波纹等效果
这是iPhone之手势切换图片示例程序,具体参考: http://blog.csdn.net/htttw/article/details/7881955
jquery制作仿iphone苹果手机界面触屏切换效果.rar
1.这个是iPhone的一些动画转换,大概有20多个吧,还挺有用的 2.这个是源码,主要实现的是场景之间切换的时候的动画
iphone页面翻转效果,适合电子杂志类开发,未使用私有api,比较通用
一款使用html5 svg技术制作的线条动态绘制iphone边框动画效果,页面中先是用线条动态绘制出iphone的轮廓,然后再显示iphone图片,效果十分华丽。
这是一个仿iphone斜拉的横向3D图片切换效果demo,实现了iphone图片浏览的效果
iPhone 应用界面设计资源,非常好啊哈哈
iphone 开发各种特效,包含了绝大部 页面切换展示的效果,总结的非常全面含有源码。
Mac 平台下仿iPhone上下载App 的动画
iphone范例代码,翻转动画特效 一个示范翻转动画的代码范例
android动画效果,很实用的.
这是一款使用纯css3制作的非常逼真的iPhone6动画效果。这款iPhone6动画效果中没有使用任何图片,所有的图像和动画都使用css3完成。
iphone上的一个圆环动画效果
仿IPHONE界面的切换,里面有详细的代码分析
iphone应用之微信摇一摇效果,振动,图片上下移