1.实现转场效果
通过transitionWithView方法来实现视图的转场效果:
[UIView transitionWithView:_myView duration:2.0 options:UIViewAnimationOptionTransitionCrossDissolve animations:^{ CGRect temp = _myView.frame; temp.origin.x += 100; _myView.frame = temp; [UIView transitionWithView:_mySecondView duration:1.0 options:UIViewAnimationOptionTransitionCrossDissolve animations:^{ CGRect temp = _mySecondView.frame; temp.origin.x += 200; _mySecondView.frame = temp; } completion:nil]; } completion:nil];
效果图:
2.从一个视图到另外一个视图:
UIView *view = [[UIView alloc]initWithFrame:CGRectMake(50, 250, 150, 50)]; view.layer.cornerRadius = 15; view.backgroundColor = [UIColor purpleColor]; [UIView transitionFromView:_myView toView:view duration:2.0 options:UIViewAnimationOptionTransitionFlipFromTop completion:nil];
效果图:
原文:http://www.cnblogs.com/moxuexiaotong/p/4964719.html