iphone – transition between 2 UIImages – Education Career Blog

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 *types4 = {kCATransitionMoveIn, kCATransitionPush, kCATransitionReveal, kCATransitionFade};
    NSString *subtypes4 = { kCATransitionFromLeft, kCATransitionFromRight, kCATransitionFromTop, kCATransitionFromBottom};

    transition.type = typestype;

    transition.subtype = subtypessubType;


    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:
alt text

but it displays like this:

alt text

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.

Leave a Comment