[Code notes] fade out and fade out
I ,.
2. Engineering Drawing.
3. Code.
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 * view = [[UIView alloc] initWithFrame: CGRectMake (10,100,200,200)]; view. backgroundColor = [UIColor redColor]; [self. view addSubview: view]; // Fade Out // [self fadeOut: view]; // fade in // [self fadeIn: view];} // fade out-(void) fadeOut :( UIView *) view {CGContextRef context = values (); [UIView beginAnimations: nil context: context]; [UIView setAnimationCurve: values]; [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 .}