2016-03-05 79 views
0

我目前正在制作一个使用UIScrollView的应用程序。在scrollview上,我显示了项目的简短描述。对于一个项目,我有四到五个描述和一个文档类型在右侧。如图所示在滚动顶部需要将doc文件滚动到底部直到特定项目描述结束。基于ScrollView滚动更改UILabel来源在ios中的位置

enter image description here

我怎样才能做到这一点呢?

+0

你将不得不GI比那更多的信息,你究竟想要发生什么?该屏幕截图没有帮助。 – jakedunc

回答

0

以下是基本步骤 - 您需要根据您的代码计算出详细信息。

  1. 在这个滚动型的VC,实现UIScrollViewDelegate
  2. 设置UIScrollView.delegate到VC(例如,在viewDidLoad中) - 像self.scrollView.delegate = self;(假设你的IBOutlet中的滚动型被称为scrollView
  3. 在VC添加以下代码(填写实际的代码做说什么评论):

    -(void)scrollViewDidScroll:(UIScrollView *)scrollView { 
        // scrollView.contentOffset is the scroll position of the scroll view 
        // Look at that and where your label sections are 
        // set the AgendaLabel.center or AgendaLabel.frame appropriately 
    }