Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Narendar Singh

macrumors member
Original poster
Jun 22, 2012
76
0
INDIA
Please see attached image for the reference, I have a problem with sizeToFit() function in UILable.
 

Attachments

  • sizeToFit.png
    sizeToFit.png
    6.6 KB · Views: 181

robbieduncan

Moderator emeritus
Jul 24, 2002
25,611
893
Harrogate
The origin of the coordinate system is on the left. The position of any view is based on the left (for the x component of position) Size to fit changes the size but not the position of the component. So the behaviour is exactly what you should expect: position unchanged and size changed.

For sizeToFit: to do what you are expecting it would have to change the position as well as the size.
 

Narendar Singh

macrumors member
Original poster
Jun 22, 2012
76
0
INDIA
The origin of the coordinate system is on the left. The position of any view is based on the left (for the x component of position) Size to fit changes the size but not the position of the component. So the behaviour is exactly what you should expect: position unchanged and size changed.

For sizeToFit: to do what you are expecting it would have to change the position as well as the size.

Yes I want to change position too. What should I do now?

dejo: I'll update soon.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.