0

我一直在查看加载屏幕的不同示例 - 有没有办法在检测到点击时插入过渡屏幕(滑动)?目前 UIImage.imageNamed 会立即加载下一个图形 - 如何让它滑动?

def viewDidLoad
  view.image = UIImage.imageNamed('welcome.png')

  view.userInteractionEnabled = true
  recognizer = UITapGestureRecognizer.alloc.initWithTarget(self, action:'nextScreen')
  view.addGestureRecognizer(recognizer)
end
4

1 回答 1

2

这是一种nextScreen应该做你想做的事情的方法。通过动画设置,view.image = ...线条将从右侧滑入图像。

def nextScreen
  animation = CATransition.animation
  animation.duration = 0.5
  animation.type = KCATransitionMoveIn
  animation.subtype = KCATransitionFromRight
  view.layer.addAnimation(animation, forKey:'imageTransition')
  view.image = UIImage.imageNamed('pic2.png')
end

来源:https ://stackoverflow.com/a/5057691/424300

于 2012-06-12T14:46:44.330 回答