Objective C multiline UILabel is not working - objective-c

Here I have attached the scenario of my issue.
Current View
Here Top Title is a bit long string. But my view is shown partially.
Here I added the storyboard properties that I used for my UILabel.
Can someone suggest a solution to make this UiLabel as multilined one ?

You can't have a multi-line label with a fixed font size, if that label is constrained to a certain height.
Either the height needs to scale to allow more lines at that fixed font size, or the font size needs to scale down to fit all the text in.
If neither are possible, then the text will be truncated.
If your label is constrained to a certain height, then you can change the Autoshrink setting from Fixed font size to Minimum font size and specify the smallest size that you will allow the font to shrink to in order to accommodate longer strings.

Try to change the relation of constraint height: Greater than or equal

Related

iOS 7 Autolayout does not correctly resize UILabel when font size is large

I used the solution here (UILabel sizeToFit doesn't work with autolayout ios6) to get the UILabel to fit the text.
However, when I increased my font size, the height did not fit any more.
I am not familiar with typography, but I guess the padding within the bounding box of the text always exists, and it is just not obvious when font size is small.
In my project, the text in the UILabel switches between two fonts, and the difference of padding makes it so hard to align it with other controls on the same view.
So my question is, how can I get rid of the padding-top and padding-bottom in a UILabel with large font-size?
Simply, you can't.
But you can decrease the Height accordingly as font increases using following formula,
Int heightToDecrease = FontSize - 12; //Change the value to fit your font family.
lblText.frame = CGRectMake(lblText.frame.origion.x, lblText.frame.origion.y, lblText.frame.size.width, lblText.frame.size.height - heightToDecrease);
I know this is not the perfect solution but it will help you for sure.

Get Font for textbox with fixed width

Having VB textbox control with fixed width. How to measure or set font size of the control for given string length ? The string/text should fit into the textbox completly.
You can use Graphics.MeasureString to measure a string drawn with a specified font. For example, cycle through several font sizes and pick one that fits best into your textbox width.
Another way, which supposedly works better with non-ASCII characters, is TextRenderer.MeasureText. Suggested by this answer.

How to adjust the font size of the UINavigationBar so that it fits the size of the titleView?

I like to use the default size of UINavigationBar.
However, sometimes the title is too long and I want the font size to get reduced appropiately.
How would I do so?
I suppose, first I need to find out the size of the titleView first. I think that can be done.
Then I need to call a function that will tell me the appropriate font size.
Then I would need to specify the font with that size WITHOUT changing the font name for that UINavigationBar.
Anyone knows how to do any of those (doesn't need to be all).
You need to set the titleTextAttributes property of the UINavigationBar. You can get the font size and font type from the same property and adjust or change the font size and font type depending on ur requirement.
Check out the documentation for more details on the same.
http://developer.apple.com/library/ios/#documentation/uikit/reference/UINavigationBar_Class/Reference/UINavigationBar.html

How to Know the maximum font size allowed for a given font name?

Is there any way to know the maximum size a font allowed.
I am doing
textInputTextView.font = [UIFont fontWithName:currentFontName size:doubleFontSize];
frame.size = textInputTextView.contentSize;
For different fonts I am getting wrong contentSize when doubleFontSize is more than 70. For some fonts I get wrong contentSize when doubleFontSize variable is only 40.
I am guessing textView.font = doubleSizeFont is too big for those particular fonts. All are ok when font size is small between 10 to 30.
Is there any way to know the maximum size allowed by a particular font?
Details:
I need an image from UITextView. I am using UIGraphicsGetImageFromCurrentImageContext image is producing ok. But I realized image quality is low. So I tried to make the TextView frame and font double.
When I Write in big font "I am a good boy" if good is the right most word. I get "I am a boy" the right most word good disappears I get some blank space on right side of the image. How tragic :)
You Can Calculate height/Width of the content by using the following code.Then resize your frame. Here my Width is fixed (290) and Calculating the height.
CGSize strSize= [DataToBeDisplayed sizeWithFont:[UIFont systemFontOfSize:17.0] constrainedToSize:CGSizeMake(290.0,99999.0)];
frame.size.height = strSize.height
I believe the issue that you are having is because you are using an UITextView. Text views inherits from the UIScrollView so it would not decrease the size of your font, it would only adapt its contents size and make your text scrollable.
Use an UITextField instead which also inherits from the UIView (thus can be used as an image) but allows for greater control. Fix its size to the maximum you would like it to be on screen and then working with both the [mylabel adjustsFontSizeToFitWidth:Y/N] and the [mylabel setminimumfontsize:somefontsize] methods, constrain it if too much text is entered. This will yield you a crisp big font and dynamically fit it upon input
~/End of Line

Phantom warning: Unsupported configuration minimum font size is greater than current font size

XCode is giving me a warning about my minimum font size being greater than my current font size. When I click on the warning, it takes me to a XIB file but it only highlights the outer object, none of the inner objects which actually have a font size attribute. Just to be sure, I went through each object and made sure their minimum font size was smaller than their current font size, but Xcode still gives me this warning. What is this warning trying to point to?
I fixed this issue by increasing the font size on a label object, then toggling off auto shrink on it, then rebuilding, then turning auto shrink back on.
There are two scenarios at play, and two solutions accordingly:
1) If you want to auto-shrink your label
Increase the minimum font size of your label to something safe, say 16point
Modify your code to set the font size to your desired font size at run-time
2) If you don't care about auto-shrink: simply change the "Autoshrink" setting to "Fixed Font Size" and this should correct the behavior regardless of what you have your font size set to in Interface Builder
I had the same problem and it was difficult to identify which label was the problem.
Then I opened the storyboard as Source Code and search for minimumFontSize. I compared minimumFontSize with fontDescription's pointSize, to check which value was equal to or greater than the minimumFontSize.
Replace minimum font size with minimum font scale.