Question

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

Was it helpful?

Solution 2

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.

OTHER TIPS

You can use the delegate to detect when the zoom changes, and make your label visible then:

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

Play with different values for minimunScaleToShowZoom and check which one suits you.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top