0
我使用下面的代碼在兩個UIImageView之間轉換。2 UIImages之間的轉換
-(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;
}
它們都在UIView'aUIView'上。 我想要的結果是這樣的:
,但它顯示是這樣的:
它看起來像toImageView來自aUIView之外。
歡迎任何評論。
甚至我用[self.view bringSubviewToFront:anyUIViewAroundaUIView]; – arachide 2010-10-21 11:59:57
將任何uiview帶到前面,結果一樣。它會透明地顯示到UIImageView – arachide 2010-10-21 12:00:48
和toImageView肯定是一個UIView的子視圖,對吧? – Maffo 2010-10-21 13:20:45