【代码笔记】iOS-淡出淡入效果
来源:互联网 发布:彩虹易支付源码 编辑:程序博客网 时间:2024/06/03 20:10
一,效果图。
二,工程图。
三,代码.
ViewController.h
#import <UIKit/UIKit.h>@interface ViewController : UIViewController@end
ViewController.m
#import "ViewController.h"@interface ViewController ()@end@implementation ViewController- (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. //UIView UIView *view=[[UIView alloc]initWithFrame:CGRectMake(10, 100, 200, 200)]; view.backgroundColor=[UIColor redColor]; [self.view addSubview:view]; //淡出 //[self fadeOut:view]; //淡入 //[self fadeIn:view]; }//淡出-(void) fadeOut:(UIView *)view{ CGContextRef context = UIGraphicsGetCurrentContext(); [UIView beginAnimations:nil context:context]; [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; [UIView setAnimationDuration:0.3]; [view setAlpha:0.0f]; [UIView commitAnimations];}//淡入-(void) fadeIn:(UIView *)view{ CGContextRef context = UIGraphicsGetCurrentContext(); [UIView beginAnimations:nil context:context]; [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; [UIView setAnimationDuration:0.3]; [view setAlpha:1.0f]; [UIView commitAnimations];}- (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated.}
0 0
- 【代码笔记】iOS-淡出淡入效果
- 页面跳转淡入淡出效果代码
- IOS UIView的淡入淡出效果
- 页面淡入淡出效果
- 淡入、淡出效果
- 淡入淡出效果
- 窗口淡入淡出效果
- 窗体淡入淡出效果
- jquery淡入淡出效果
- 实现淡入淡出效果
- 窗体淡入淡出效果
- jQuery 效果 - 淡入淡出
- jquery 淡入淡出效果
- 淡入淡出效果
- 淡入淡出效果
- jQuery 效果 - 淡入淡出
- javascript 淡入淡出效果
- jQuery 效果 - 淡入淡出
- Error:Cause: peer not authenticated 异常
- C++回调机制实现(转)
- ROS学习小结(一):ROS安装
- 2015年十大热门Android开源新项目
- (java)Word Pattern
- 【代码笔记】iOS-淡出淡入效果
- iOS适配流程规范
- Windows下LuaJIT的编译和使用,将Lua脚本编译为bytecode
- 定时器倒计时功能
- 18-《电子入门趣谈》第三章_电子世界中的五官---传感器-3.2.3霍尔传感器
- lynx
- Apache Shiro 角色和权限
- UINavigationController push到第二界面,平移手势右滑可退回到第一界面
- js基础