UIView 的transitionFromView方法实现视图切换

#import "ViewController.h"

@interface ViewController ()
@property (strong, nonatomic) IBOutlet UIImageView *imageViewFirst;
@property (strong, nonatomic) IBOutlet UIImageView *imageViewSecond;
@property(nonatomic,assign)__block BOOL rectToVisible;
@end @implementation ViewController - (void)viewDidLoad
{
[super viewDidLoad];
_rectToVisible=YES;
[self.view addSubview:_imageViewFirst]; }
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
if (_rectToVisible) { [UIView transitionFromView:self.imageViewFirst toView:self.imageViewSecond duration: options:UIViewAnimationOptionTransitionFlipFromLeft completion:^(BOOL finished) { NSLog(@"animatioin complete");
_rectToVisible=!_rectToVisible; }];
}
else
{
[UIView transitionFromView:self.imageViewSecond toView:self.imageViewFirst duration: options:UIViewAnimationOptionTransitionFlipFromRight completion:^(BOOL finished) { NSLog(@"animatioin complete");
_rectToVisible=!_rectToVisible; }];
} } @end
上一篇:【noip2012】疫情控制


下一篇:arcgis api for js入门开发系列六地图分屏对比(含源代码)