Search code examples
iosiphoneuiviewuilabeluipinchgesturerecognizer

UILable numberoflines and font size automatically set during zoom in out time


My requires is as below.

i have a added UILable inside UIView width & height is 30. i have set UIPinchGestureRecognizer to that UIView. Pinch in out functionality is working fine with UIView.

But my i want that when i zoom in UILable font size and numberOfLine automatically set in that UIView.

So at initial UILable not visible in View. When i Zoom in that time UILable get the are to display text so than UILable will be visible (ex. This time in 3 line). If i increase the Zoom level than text will be display in one row.

how can archive this functionality ?

See the below screenshot What i want to do

enter image description here ******** Image 1 *****************

enter image description here ******** Image 2 *****************

enter image description here ******** Image 3 *****************

Thanks in Advance ..


Solution

  • See this: resize all subview in scrollViewDidZoom On scrollViewDidZoom you can set the font size proportionally to zoomScale. I would suggest to set numberOfLines to 0 on label, but of course you can set it manually too when zooming in/out.