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.
Related
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
I have a ViewController with an UITextView on it. I have several paragraphs in UITextView and am trying to give different fonts and colors on each paragraph. In the last paragraph, I made it center aligned and changed the color to red. Just the last paragraph.
Here is a change I made in storyboard:
And below image is what I see in storyboard. You can see the change is correctly being made.
However, when I run the app the changes I made (center aligned, red color) are applied to all paragraphs in the textview when I only made the changes on one paragrpah. Is there a way to make changes only on certain parts of the text in UITextView??
I don't have Xcode with me right now, but I feel it might have to do with a bug in Xcode where setting attributed text in IB either doesn't work or gives the wrong result. Try the solutions here (which sadly still apply to iOS 9/Xcode 7), or if that doesn't work, you may have to just do it programatically (using NSAttributedString to set the text on the text view).
Whenever I tap on my UITextView on my testing device, the text is pushed far to the right as demonstrated in the gif below.
I can't see why this behaviour is happening, within my Storyboard I have tried to disable scrolling and have applied constraints to ensure that the width of the UITextView is only ever the width of the device, yet this still happens. The UITextView has not been subclassed or had any additional attributes applied to it via code.
If anybody has had this problem before it would be great to get some insight around how I could remedy it.
EDIT Constraints for the text view.
I have a UItableViewController, with a UITextField in each cell, pretty basic. I decided to get a bit fancy and alternate the row colors by setting the background color of the text field.
What I noticed is that the text field background color does not match up with the table rows. The width is shorter and the height and position is wrong too.
I tried setting the dimensions of the frame of the text field in cellForRowAtIndexPath. I also tried the same in willDisplayCell. I also tried to muck around with other frames, like the cell frame, to no avail.
I've had some some luck in setting the text field frame size in layoutSubviews in my UITableViewCell subclass, but it still acts strangely. When the table first displays, everything looks right. I click my edit button, and everything still looks right. I click the done button and I'm back to the old problem with both the width and height too short. Checking in the debugger, I am setting everything to the correct values.
More Information:
I have the same problem with some tables which have UILabels instead of UITextFields. All of the tables have fixed size rows. I initially set up the tables with the interface builder, but I'm trying to set the frame sizes programmatically. I am using the latest and greatest Xcode 5 (5.1.1).
Anyone have any suggestions? Where am I supposed to set the frame size? Is there another object that I should be setting the size of?
Thanks in advance
I'm working on getting an iOS app translated into Russian. All is going well except for the text on buttons.
It seems like the size of the English text defines the size that the Russian text can fit into. Since most of the Russian text is longer, it is getting cut off even though the button has plenty or empty space to the right of this text.
I've set the text on the buttons inside the viewWillAppear method. Is there a better way to handle this, or does the whole xib file need to be localized?
Have you looked at the button's autosizing settings? That would be the most likely cause of cut-off text with space to spare in the button. You can set the autosizing attributes in Xcode or programmatically with UIView::autoresizingMask.
You should not need to localize the XIB if you're setting the text in code. Autosizing should fix the issue.