Reputation: 77
The problem I am encountering now is that there is a UITextView
component in UIScrollView
and that UITextView
component will interfere the scrolling of UIScrollView
, i.e. when a user's finger is on that UITextView
to scroll the whole UIScrollView
, the screen won't scroll. The content in the UITextView
is dynamic, i.e. the size of UITextView
component is dynamic. The worst case is the whole screen is occupied by the UITextView
and users won't be able to scroll the screen at all.
The UITextView
is disabled for editing. I choose UITextView
instead of UILabel
because I want to detect phone number & link in the supplied text and utilize the built-in function to invoke dialer and browser when users click the phone number or link.
Any suggestion about how I can solve this problem or any clue about why this happens are all appreciated! Thanks.
Upvotes: 1
Views: 1257
Reputation: 115
Apart from the property scrollEnabled
, you also have the property userInterationEnabled
that disable(if you set it to FALSE
/NO
) any touch events on the view (scrolling included, of course). Hope it helps, specially for other situations cos in your case it makes the same effect as disabling the scroll.
Upvotes: 0
Reputation: 11682
If you are using a storyboard or nib file, select your UITextView
and uncheck Scrolling Enabled in Interface Builder.
Otherwise, do this:
textView.scrollEnabled = NO;
Upvotes: 1
Reputation: 953
UITextView inherits from UIScroll view so it has a property scrollEnabled. Just put it to false!
Upvotes: 1