Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 10-13-2008, 10:10 AM   #6 (permalink)
PhoneyDeveloper
New Member
 
Join Date: Sep 2008
Posts: 1,431
Default

sizeToFit will make a label adjust its frame to the correct size to hold its text. There's a gotcha that if the text is empty @"" sizeToFit will set the frame size to empty. All further calls to sizeToFit will not make the frame bigger anymore. To fix this you need to set the frame to some real size, like the original frame size, before calling sizeToFit.

Obviously there's no sense in trying to calculate the size of a label if it doesn't yet have the text that it's going to display. Set the text and then call layoutSubviews.
PhoneyDeveloper is offline   Reply With Quote
 

» Advertisements
» Stats
Members: 158,783
Threads: 89,204
Posts: 380,594
Top Poster: BrianSlick (7,129)
Welcome to our newest member, robin4kneb
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 11:51 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.