tags:

views:

21

answers:

1

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

but it displays like this:

alt text

It looks like toImageView comes from outside of aUIView.

Any comment is welcome.

A: 

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.

Maffo
even I used [self.view bringSubviewToFront:anyUIViewAroundaUIView];
bring any uiview to front, the result is same. It will transparently display toUIImageView
and the toImageView is sure SubView of aUIView, right?
Maffo
yes, toImageView is the SubView of aUIView
I guess the problem is with the direkt Modification of the Layer of ther view.But maybe you can modify the bounds property of the toView, so that the bounds.size.height is growing while animating. With the right properties the image should look like expected.
Maffo
I made mistake, your solution is right, thanks a lot.