I am displaying logs in the scroll-able text view, I want to retain this functionality but disable the keyboard. I have tried the unchecking in Behaviour of the Attribute Inspector, but it disables the scroll view too.
Can anyone guide me what options I have?
Just set the editable property of UITextView to NO or FALSE. GOod Luck!
Related
We use the IOS UIKeyboard to enter text into a UITextField which is positioned over our OpenGL View.
Is there a simple way to attach an entry field to the top of the keyboard, so it is within the frame of the keyboard and scrolls on and off smoothly with it, rather than moving your own UITextField when the keyboard scrolls on ? Maybe some property of the text field itself ?
Thanks
Shaun
You could put the whole view inside a UIScrollView
I think inputAccessoryView may be what you are looking for. It´s a property of UITextField.
See Documentation.
I have a TextView made in the Interface Builder;
It scrolls fine with its default text, but as soon as I programatically set the text to something else, it no longer scrolls.
I do not disable scrolling, and I have tried enabling scrolling (setScrollEnabled:YES), and user interaction (setUserInteractionEnabled:YES) both of which make no difference.
The things that I have found:
It scrolls with the default text showing
It doesn't seem to matter what text I set in it, it just stops scrolling as soon as it is set. I'm doing it programatically like this:
self.myTextView.text = #"any text"; (or [self.myTextView setText:#"any text"]; has the same effect.)
I have two other Textfield in the same View, one of which is using the View Controller as its delegate. The TextField in question is not using the View Controller as its delegate. None of the delegate methods set anything to do with scrolling.
Both of the other TextViews have their scrolling capability set to defaults. If I change the one that doesn't need it to no scrolling, it makes no difference to the problem.
The one that has the View Controller as its delegate continues to scroll after I edit it (non programatically) and this one continues to be able to scroll once the one in question freezes.
If I delete these two other TextFields, then the one in question works as expected, i.e. it scrolls after adding text.
Any thoughts?
Thanks.
Make sure your new text is long enough to be able to get scroll.
if text is just one line it wont scroll but if its larger then text area size then it will scroll its by default settings
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?
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)];
}
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.
EDIT: The crux of this problem is that scroll indicators do not show during programmatic scrolling, but I would like them to. My original question (provided below) assumed this had something to do with userInteractionEnabled, but it does not. The mention of a master and slave UIScrollView is also possibly distracting from my core problem (the need to show scroll indicators during a programmatic scroll). Apologies to those of you who answered or commented based on my misleading assumptions/info.
Possible Solution: The only way I found to do this was to use the fact that scroll indicators are instances of UIImageView and use a category on it to hack the alpha. This article shows the approach. It was then a case of using tags and scroll view delegate methods to turn the alpha permanently on prior to a programmatic scroll, and permanently off when the scroll is finished. This feels hacky though, so any further suggestions would be welcome!
Everything below this line is the original unedited question to provide context to users' answers and comments
Setting userInteractionEnabled in a UIScrollView object to NO appears to disable the scroll indicators upon programmatic scrolling. This happens even if you have self.showsVerticalScrollIndicator = self.showsHorizontalScrollIndicator = YES;
Is there any way to programmatically scroll the scroll view but still show the indicators?
(To provide some context: I have a slave scrollview that mimics a master scrollview by hooking up the scrollview delegate callbacks and passing the content offset to the slave scrollview. However, I don't want the user to be able to directly manipulate the slave scrollview, but I do want scroll indicators).
Instead of setting userInteractionEnabled to false try setting the UIScrollView's scrollEnabled property to false. The doc. says "When scrolling is disabled, the scroll view does not accept touch events" that should mean that you should still be able to programmatically scroll the UIScrollView. Hope this helps - Did not test it out let me know.
You could try putting a transparent UIView (alpha == 0.0) over your scroll view (but as a sibling in the view hierarchy, not as a subview). Set touchesEnabled to YES on the transparent view, and it will intercept touches heading for the scroll view.
I have a UITextView with autocorrection on. The view's height is about 30 pix. When autocorrect kicks in the autocorrect view is nearly invisible below the text. Is there a way to control the position of the small autocorrect window or insure it is the top layer so it is always visible and the user can easily see and interact with it?
I discovered that setting the scrollEnabled to false on the UITextView the popup would always appear above the word being corrected.
Did you try to set clipsToBounds=NO for your UITextView? Sounds like it's clipping the autocorrect view to the frame size of your UITextView..or perhaps auto-positioning it inside your frame. Worth a try anyway..
After trying various solutions unsuccessfully, I find the best way that worked for me is to simply add your UITextView inside a UIView.