UILable numberoflines and font size are automatically set during an increase in time

I need as shown below.

I have added one UILableinside UIView width & height is 30. I installed UIPinchGestureRecognizeron UIView. The Pinch in out function works great with UIView.

But I want that when I increase the font size UILableand numberOfLineautomatically set to this UIView.

So, at the initial, UILableit is not displayed in the view. When I zoom in at this time UILable, you must display textto be visible ( UILable) (for example, this time in 3 lines). If I zoom in than the text will be displayed on one line.

How can I archive this functionality?

See screenshot below. What i want to do

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

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

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

Thanks at Advance ..

+2
source share
2 answers

Watch this: resize all the views in scrollViewDidZoom. On scrollViewDidZoomyou can set the font size proportionally to zoomScale. I would suggest setting it numberOfLinesto 0 on the shortcut, but of course you can set it manually also when scaling / outputting.

+2
source

You can use a delegate to determine when the scale changes and make your shortcut visible:

- (void)scrollViewDidZoom:(UIScrollView *)scrollView
{
     if (scrollView.zoomScale > minimunScaleToShowZoom)
     {
         myLabel.hidden = NO;
     }
     else
     {
        myLabel.hidden = YES;
     }
}

Play with different values ​​for minimunScaleToShowZoomand check which one suits you.

+3
source

All Articles