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 68020
 
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 68020
 
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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
Multi-line system call in xcode noahgolm Mac Programming 18 Jan 7, 2011 07:48 AM
iPhone UILabel not updating jk7 iPhone/iPad Programming 6 Nov 10, 2010 07:23 PM
multi-line dock vostrushka Mac Applications and Mac App Store 2 Aug 24, 2010 10:07 AM
All I want is a simple multi-line TextField BadWolf13 Mac Programming 9 Apr 13, 2010 11:20 AM
How to support multi-line text cells in a tableview tmeehan Mac Programming 2 Mar 10, 2009 03:50 PM


All times are GMT -5. The time now is 02:36 AM.

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

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