I want to zoom in and out UITextView
font size using pinch gesture.
And I am applying styles like Bold, Italic, Underline etc on UITextView
.
But when i zoom in and out, formatting was gone.
How can i solve this?
I am Using following code:
- (void)handleTextFieldFontOnAddMusicVc:(UIPinchGestureRecognizer *)pinchGestRecognizer{
if (pinchGestRecognizer.state == UIGestureRecognizerStateEnded
|| pinchGestRecognizer.state == UIGestureRecognizerStateChanged) {
CGFloat currentFontSize = self.myTextField.font.pointSize;
CGFloat newScale = currentFontSize * pinchGestRecognizer.scale;
if (newScale < 20.0) {
newScale = 20.0;
}
if (newScale > 60.0) {
newScale = 60.0;
}
self.myTextField.font = [UIFont fontWithName:self.myTextField.font.fontName size:newScale];
pinchGestRecognizer.scale = 1;
}
}