Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Aug 23, 2008, 10:49 AM   #1
admanimal
macrumors 68040
 
Join Date: Apr 2005
Multi-line UILabel adjustFontSizeToFitWidth

Has anyone figured out how to get the auto font size adjustment to work for a UILabel when it has numberOfLines set to more than one? It seems to just ignore adjustFontSizeToFitWidth if the label has more than one line.
admanimal is offline   0 Reply With Quote
Old Oct 2, 2008, 01:01 AM   #2
siva.d
macrumors newbie
 
Join Date: Oct 2008
Location: Hyderabad,India
Send a message via Yahoo to siva.d Send a message via Skype™ to siva.d
I also need this can any one help

Thanks in advance,

I want to display text in more than one line, can any one help me.

Thank you
siva.d
siva.d is offline   0 Reply With Quote
Old Oct 2, 2008, 10:24 AM   #3
PhoneyDeveloper
macrumors 68030
 
PhoneyDeveloper's Avatar
 
Join Date: Sep 2008
Did you read the comment in UILabel.h where it says that adjustsFontSizeToFitWidth only works if lineCount is 1?
PhoneyDeveloper is offline   0 Reply With Quote
Old Oct 2, 2008, 11:21 AM   #4
Niiro13
macrumors 68000
 
Join Date: Feb 2008
Location: Illinois
Send a message via AIM to Niiro13 Send a message via MSN to Niiro13 Send a message via Yahoo to Niiro13
So in other words, you'll have to use a UITextView which has a dynamic number of lines but fixed font size.
Niiro13 is offline   0 Reply With Quote
Old Oct 2, 2008, 12:19 PM   #5
PhoneyDeveloper
macrumors 68030
 
PhoneyDeveloper's Avatar
 
Join Date: Sep 2008
Dynamic number of lines with a fixed font size is exactly what UILabel gives you if you set the numberOfLines to zero. The usual reason to use adjustsFontSizeToFitWidth is if you have a fixed size for the label and you want all the text to fit. If you can allow the label to be any height then you don't need that.

Also you could probably use sizeWithFont:constrainedToSize:lineBreakMode to find the font size that will show all the text in a multiline label and then set that font size for the label.
PhoneyDeveloper is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
How would you handle multi device/multi-service sync? rsarno MacBook Pro 0 Oct 23, 2013 01:17 PM
Writing value to UILabel Kapthehat iPhone/iPad Programming 6 Jul 19, 2013 08:32 AM
UILabel Help lukin iPhone/iPad Programming 3 Sep 18, 2012 07:36 PM
Stupid UILabel question mngoose iPhone/iPad Programming 7 Jun 11, 2012 08:58 PM

Forum Jump

All times are GMT -5. The time now is 09:08 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC