码迷,mamicode.com
首页 > 其他好文 > 详细

UIView 的transitionFromView方法实现视图切换

时间:2015-03-31 12:08:47      阅读:118      评论:0      收藏:0      [点我收藏+]

标签:

#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:1 options:UIViewAnimationOptionTransitionFlipFromLeft completion:^(BOOL finished) {
            
            NSLog(@"animatioin complete");
            _rectToVisible=!_rectToVisible;
            
        }];
    }
    else
    {
        [UIView transitionFromView:self.imageViewSecond toView:self.imageViewFirst duration:1 options:UIViewAnimationOptionTransitionFlipFromRight completion:^(BOOL finished) {
            
            NSLog(@"animatioin complete");
            _rectToVisible=!_rectToVisible;
            
        }];
    }
 
}



@end

 

UIView 的transitionFromView方法实现视图切换

标签:

原文地址:http://www.cnblogs.com/thbbsky/p/4380164.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!