【发布时间】:2015-06-11 17:39:04
【问题描述】:
我在屏幕上的某个位置有一个 UIImageView:
self.imageView = [[UIImageView alloc] init];
self.imageView.clipsToBounds = YES;
self.imageView.image = [UIImage imageNamed:@"food"];
[self.imageView setFrame:CGRectMake(0, 0 , (self.view.frame.size.width/5), 60)];
然后我必须在 UIImageView 中滑入另一个图像,我使用以下代码进行了操作:
self.imageView.image = NULL;
CATransition *animation = [CATransition animation];
[animation setDuration:0.75];
[animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear]];
[animation setType:kCATransitionPush];
[animation setSubtype:kCATransitionFromLeft];
animation.delegate = self;
[[self.imageView layer] addAnimation:animation forKey:nil];
但是当第一张图片滑出时,它会淡出(或者在 imageView 的边缘看起来是透明的)。我尝试了尽可能多的在线解决方案,例如在动画期间设置图层属性以移除淡入淡出或将图层不透明度指定为 1.0,但它们似乎都不起作用。任何帮助,将不胜感激。谢谢!
【问题讨论】:
标签: ios objective-c xcode uiimageview