Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to put UITextView's scroll indicator to outside UITextView?

It might be a silly question. I'm trying to set left/right margins like the attached picture. I succeeded to implement it by adding UITextView to UIScrollView. However, I could achieve almost everything I want with UITextView alone. For example, with UIScrollView, when I manually change the text of UITextView, it automatically scrolls to bottom regardless of setting its .scrollEnabled to No.

It would be perfect if a scroll indicator of UITextView appears outside UITextView. In the attached picture, let's say the red box represents the entire UITextView. I tried to change UITextView's scrollIndicatorInsets property, but a scroll indicator can be moved only inward to be visible.

Several apps such as Pages, aWriter, Plaintext achieve this feature. Could you give any suggestion?

Thank you!

I alt text

like image 862
pnmn Avatar asked Dec 03 '10 07:12

pnmn


3 Answers

UIEdgeInsets insets =  textView.scrollIndicatorInsets;
insets.right += 5; //add what ever is your margain
textView.scrollIndicatorInsets = insets;
like image 85
TtheTank Avatar answered Oct 15 '22 07:10

TtheTank


You can set the scroller right inset value of the UITextView to negative value and disable the clip subview option to achieve your require. No other scrollview is needed. alt text

like image 26
WaiLam Avatar answered Oct 15 '22 09:10

WaiLam


Alternatively you could set the Right contentInset property.

like image 21
Andrew Ebling Avatar answered Oct 15 '22 08:10

Andrew Ebling