2017-04-20 7 views
0

UIScrollView가 웹 사이트에서 말하는 것처럼 일반적인 스크롤 창처럼 동작 할 수 있습니까? 스크롤보기 내부의 다른 UIView에 초점을 맞춤으로써 스크롤을 의미하지 않습니다. 나는 가변 높이에서 확장하는 긴 UITextView 있고 사용자가 정상적으로 스크롤하고 텍스트를 읽을 싶습니다.Apple TV UITextView가있는 UIScrollView의 기본 스크롤 동작은 무엇입니까?

그러나 UITextView를 UIScrollView에 추가하면 (주어진 contentSize로 둘 다) 결과가 달라집니다. 구현 된

:

txtView.isScrollEnabled = true 

깜짝 아무도 그 대답하지 :

//:: 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) 

답변

0

은 UITextView에서 스크롤 활성화있는 UIScrollView 광고를 제거하는만큼 쉬웠다.