为什么UIView右移offsetBy

问题描述:

我有一个UIImageView的滚动视图。当用户滚动时,我想将UIImageView保留在原来的位置。我使用offsetBy此:为什么UIView右移offsetBy

func scrollViewDidScroll(scrollView: UIScrollView) { 
    let offset = scrollView.contentOffset.y 

    self.headerView!.currentLoadLabel.frame = currentLoadLabelFrame.offsetBy(dx: 0, dy: offset) 
} 

的UIImageView的停留在他的Y位置,而是移动到屏幕右侧的最远x位置。为什么?

试试下面的代码: self.headerView .currentLoadLabel.frame = currentLoadLabelFrame.offsetBy(DX:scrollView.contentOffset.x,DY:scrollView.contentOffset.y)

+0

没有,这有相同的效果.. .. – AntonSack