2017-06-23 45 views
1

我正在查找要滾動到底部的文本。就像你會在電影中看到的一樣。我不想將textview的x,y位置從上到下移動文本。在文本視圖中爲文字添加動畫效果(swift3)

import UIKit 

class ViewController: UIViewController { 

@IBOutlet var text: UITextView! 
override func viewDidLoad() { 
    super.viewDidLoad() 
    // Do any additional setup after loading the view, typically from a nib. 
} 

@IBAction func play(_ sender: Any) { 
} 


} 

enter image description here

+0

你的代碼是完全不相關的。請從問題中刪除它。 – Mundi

回答

2

使用UIScrollView和滾動UILabel在它的文本。

您可以使用標準UIView動畫與定時和可選的動畫曲線,並在關閉中設置contentOffset

UIView.animate(withDuration: 10.0) { // 10 seconds 
    scrollView.contentOffset = CGPoint(x: 0, y: maxDesiredScrollPosition) 
} 
相關問題