transition between 2 UIImages
<p>I use the code below to transition between two UIImageViews.</p>

<pre><code>-(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;

}
</code></pre>

<p>Both of them are on an UIView 'aUIView'.
I want the result to be like this:
<img src="http://i.stack.imgur.com/VdWVP.png" alt="alt text"></p>

<p>but it displays like this:</p>

<p><img src="http://i.stack.imgur.com/foNW5.png" alt="alt text"></p>

<p>It looks like toImageView comes from outside of aUIView.</p>

<p>Any comment is welcome.</p>
