How to resize UILabel text after zooming UIScrollview zoomable
- by netadictos
I have an UIScrollview that is zoomable, the subview is one UIView (viewTexto) that contains an UILabel inside (messageLabel).
This is the code
- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollViewtmp{
return viewTexto;
}
-(void)scrollViewDidEndZooming:(UIScrollView *)scrollViewtmp withView:(UIView *)view atScale:(float)scale{
messageLabel.contentScaleFactor=scale;
[scrollView setContentSize:CGSizeMake(scrollView.frame.size.width, messageLabel.frame.origin.y + messageLabel.frame.size.heightt)];
}
With this code I can zoom, and the text is not blurry, there is no horizontal scroll but the size of the UILabel continues to be too large, so it is cut. I need that the width of the UILabel adopts to the scrollView width again as at the beginning.
I have read any question about UIScrollViews in SO and having found exactly what I need.