使用UITextView的UIScrollView的Apple TV默认滚动行为?

时间:2017-04-20 15:26:00

标签: swift3 uiscrollview uitextview apple-tv

是否有可能让UIScrollView的行为像在网站上看到的普通滚动窗口一样?意思是不通过关注滚动视图内的不同UIViews来滚动。我有一个很长的UITextView,它在可变高度扩展,我希望用户正常滚动并阅读文本。

但是将UITextView添加到UIScrollView(两者都有给定的contentSize)并没有给我任何结果。

已实施:

    //::  Scroll View
    scrollView = UIScrollView(frame: CGRect(x: 0, y: 0, width: 1920, height: 1080))
    scrollView.autoresizingMask = [.flexibleHeight]
    scrollView.translatesAutoresizingMaskIntoConstraints = true
    scrollView.backgroundColor = UIColor.red


    scrollView.addSubview(txtView)
    view.addSubview(scrollView)

    //::  Anchor
    txtView.translatesAutoresizingMaskIntoConstraints = false;
    txtView.topAnchor.constraint(equalTo: view.topAnchor, constant: 120).isActive = true
    txtView.centerXAnchor.constraint(equalTo: view.centerXAnchor, constant: 0).isActive = true
    txtView.widthAnchor.constraint(equalToConstant: 825).isActive = true
    txtView.contentSize = CGSize(width: 825, height: 2000)
    txtView.clipsToBounds = false

    scrollView.isScrollEnabled = true
    scrollView.showsVerticalScrollIndicator = true
    scrollView.contentSize = CGSize(width: 1920, height: 2000)

1 个答案:

答案 0 :(得分:0)

就像在UITextView上删除UIScrollView广告启用滚动一样简单:

export SPARK_HOME=/usr/lib/spark;
export PYTHONPATH=$SPARK_HOME/python:$SPARK_HOME/python/lib/py4j-0.9-src.zip:$PYTHONPATH

惊讶没有人回答这个问题。