Reputation: 5337
I've got a UITextView
I'm using that has clickable links in it (ie, html links). I've set scrolling to be disabled.
By default "User Interaction Enabled" is false, and scrolling does not occur. However, in order to get the links to be clickable, "User Interaction Enabled" must be true. Given that, even with scrolling disabled, it is still possible to scroll the text if it exceeds the height of the UITextView
.
My text is supposed to fit in the UITextView
, so mostly this isn't a problem, however sometimes there is extra space at the bottom, and it cuts off a couple lines, and I don't want to ever allow that scrolling.
Is there a way to forcefully disable scrolling given these circumstances?
Upvotes: 1
Views: 2188
Reputation: 184
UPD:
1) As I understand you use textview just for displaying text with links, there are no editing or scrolling. If you add it using Interface Builder - make sure that you turned of editing, scrolling, selection options like on the screenshot. But selection might be on for URL detection.
Or do it in code using properties editable, selectable, scrollEnabled
2) If you want unselectable textview with URL - you might look for other control to archive this. Look at OHAttributedLabel, it is multi-lined and has link detection, and no text selection or scrolling.
Upvotes: 1
Reputation: 11696
How about just disabling vertical scrolling via the UITextView delegate like this:
- (void)scrollViewDidScroll:(id)scrollView
{
CGPoint origin = [scrollView contentOffset];
[scrollView setContentOffset:CGPointMake(origin.x, 0.0)];
}
Upvotes: 4