Text is not appearing when UITextView's content is more? - ios

I don't need to scroll inside a UITextView so disabling a scrolling property of my UITextView.
It means UITextView's height is dynamic base on his content.
When I added more text in UITextView then text is not appearing.
It is working with less content.
As per my observation if height of UITextView exceeds 8100 then it stops rendering but not sure about it.
here is a structure of storyboard.

I understand your problem and please check below sample, i am modify your sample. This is working in my case.
Refer:- Updated Demo

Related

UITableView with dynamic height in Swift

I would like to create a dynamically sized UITableView in Swift.
When I add a UITableView via the storyboard some content is cut off at a certain point.
Is there a way to make it possible to scroll through the content without cutting off any of it? I've thought about adding a UIScrollView, but this kind of view seems to be used for something else (e.g.: http://www.raywenderlich.com/76436/use-uiscrollview-scroll-zoom-content-swift )
At best I'd like to have a scrollable UITableView that almost fills the screen and a button that always stays on the very bottom.
Edit - To clarify what I meant by cutting off: When there are e.g. 100 elements in an array, only 10 were displayed.
But the concept of placeholder constraints solved this issue, since my array length is determined during runtime.
To have a dynamically sized UITableView, use AutoLayout. https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/AutolayoutPG/Introduction/Introduction.html
Yes its possible to not cut your content, but how is your content cutted ? Could you link a screenshot about it ?
You didn't talk about your constraints, did you set yours correctly ?
For example, you can set them like that for :
UITableView:
UIButton:
UITableView is a subclass of UIScrollView, your link show a specific usage of UIScrollView options (Paging), but it is not the default behavior of this component.
Here is an example: http://spin.atomicobject.com/2014/03/05/uiscrollview-autolayout-ios/

Text is not fully displayed in UITextView

My UITextView is being very weird.
To explain the problem, the UITextView is placed in an UITableViewCell, and at the first display, the second line is missing :
If I continue scrolling down, and go back to see this UITextView, everything is back to normal:
What is very weird, is that if I set my UITextView as none selectable (what I want in fact), the text is well displayed, but the font is lost :
It seems that I have the same problem described here:
UITextView - setting font not working with iOS 6 on XCode 5
and the fix given (setting the UITextView as Selectable) worked fine for the font. But this problem with the cropped text makes this solution inadequate.
The UITextView has a red background color to be sure that the size is ok.
Everything is done in a Storyboard, but I also tried to set the font manually, the problem is still there.
Have you any hint of what could be wrong?
You can use AutoLayout to adjust the UITextView size inside the cell or you can use
[cell.textView sizeToFit];
I recommend using AutoLayout as it shouldn't harm the performance so much.

"Manually" handling text and cursor position of UITextView breaks when there are multiple lines

I have a narrow UITextView (about 1 line in height) to which I only add text programmatically, setting the text property of it as I click buttons. I also handle the cursor position manually, setting the selectedRange as the text changes. All works great as long as I have only one line of text.
When I have two or more lines of text and try to insert text at the first line, the text is inserted correctly and the cursor position is still at the right place but the UITextView scrolls to the bottom. When I then add another piece of text at the top it scrolls up to the "correct" position. This pattern then repeats for every entered piece of text at a line other than the last, making the UITextView scroll up and down for every button pressed.
I also tried calling UITextView scrollRangeToVisible: passing the selectedRange property as argument after setting the new text. That didn't work either.
I finally tried setting selectedRange after a 0.5 s delay after I set the text. Then it works as it should, but only after the UITextView has first been scrolled down to the bottom for 0.5 s. This seems to indicate that the setText method of UITextView is asynchronous in some way, and completes after I have already set selectedRange or called scrollRangeToVisible, and readjusts the UITextView to what it believes is the desired.
Can anyone tell me what is going on, and how I can get around the problem.
Thanks!
The auto scroll behavior of UITextFields can be annoying and difficult to harness at times.
Do you need the user to manually edit the text? If not, use a multiline UILabel.
If yes, also use a multiline UILabel and exchange it on the fly against a UITextView once the user taps. Change it back on didEndEditing. This techniques has worked well for me in table views.
I solved the problem!
When starting in the maze of creating a custom input view, I began implementing UITextInput and I found that the UITextInput protocol declares many interesting methods. And what is awesome is that UITextView implements that protocol. So even though it's not in the immediate UITextView API reference, you can call all UITextInput methods on your UITextView. For instance insertText: (from UIKeyInput protocol) and replaceRange:withText:. They made it much more flexible to programmatically work with a UITextView. Hope this can help someone else too!

How to scroll cut off text iOS tableview like a moving banner

I have a tableview with dynamic data from a parsed xml file. I have set a default font size, and for most entries, it works okay. However, some have an entry that seems to be cut off.. and Apple simple adds "..." to the end.
Is there a way I can implement something like a slowly scrolling banner to accommodate this? And if not, is there a way I can make the text fit if it exceeds the size without making a global change to all entries?
I think for the slowly scrolling banner you would have to implement that yourself by animating your views.
If you don't expect your text to exceed the size by that much you could try using minimumScaleFactor in ios6:
[label setMinimumScaleFactor:.75f];
or minimumFontSizeSize for < ios6.
These essentially shrink the text to fit the frame.
p.s. you can configure these in interface builder

UITextView and position of floating autocorrect window

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.

Resources