2015-11-19 38 views
1

我期待在Xcode中使用我的textView,以便從頂部開始,因爲它目前在頂部開始。將textView設置爲從頂部開始(Swift)

//This is the code I'm using currently to try and have it start at the top 

self.productDescription .scrollRangeToVisible(NSMakeRange(0, 0)) 

但是,這是行不通的。任何人有任何想法可能是什麼問題?

回答

3

默認情況下,UITextView元素具有contentInsets。你可以嘗試改變textView.contentInset的價值觀,像這樣:

textView.contentInset = UIEdgeInsetsMake(-4,-8,0,0);

+0

這工作!非常感謝! – RedLineTom

+0

不客氣:-) – Wesley