transition between 2 UIImages
I use the code below to transition between two UIImageViews.
-(void)performTransitionNew: (NSInteger)type subType:(NSInteger)subType
fromImageView:(UIImageView *)fromImageView
toImageView:(UIImageView *)toImageView duration:(NSInteger)duration;
{
CATransition *transition = [CATransition animation];
transition.duration = duration;//0.3;
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
NSString *types[4] = {kCATransitionMoveIn, kCATransitionPush, kCATransitionReveal, kCATransitionFade};
NSString *subtypes[4] = { kCATransitionFromLeft, kCATransitionFromRight, kCATransitionFromTop, kCATransitionFromBottom};
transition.type = types[type];
transition.subtype = subtypes[subType];
transitioning = YES;
transition.delegate = self;
[self.aUIView.layer addAnimation:transition forKey:开发者_高级运维nil];
fromImageView.hidden = YES;
toImageView.hidden = NO;
UIImageView *tmp = toImageView;
toImageView = fromImageView;
toImageView = tmp;
}
Both of them are on an UIView 'aUIView'. I want the result to be like this:
but it displays like this:
It looks like toImageView comes from outside of aUIView.
Any comment is welcome.
The Problem is, that the UIView is on top of the other View (were the slider is) You could change the order of these views. If a UIView is in front of another, the Subviews are also, no matter if they are in the bounds of the parent view or not.
精彩评论