iOS: Escalonando o UITextView com beliscões?
Estou interessado em criarUITextView
que está se expandindo dinamicamente enquanto digita o texto, e escalando conforme o usuário aperta a tela (Comportamento semelhante pode ser encontrado no TinyPost).
Quando você digita (sem beliscar), o textView expande-se bem. Quando você apenas aperta (sem digitar) funciona bem, mas quando você aperta e digita, o texto fica cortado.
Aqui está o meu código:
UIPinchGestureRecognizer *pinchGestRecognizer = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(scaleTextView:)];
pinchGestRecognizer.delegate = self;
[bgFrameImageView addGestureRecognizer:pinchGestRecognizer];
- (void)scaleTextView:(UIPinchGestureRecognizer *)pinchGestRecognizer{
createTextView.transform = CGAffineTransformScale(createTextView.transform, pinchGestRecognizer.scale, pinchGestRecognizer.scale);
pinchGestRecognizer.scale = 1;
}
- (void)textViewDidChange:(UITextView *)textView{
CGSize textSize = textView.contentSize;
textView.frame = CGRectMake(CGRectGetMinX(textView.frame), CGRectGetMinY(textView.frame), textSize.width, textSize.height); //update the size of the textView
}
O que você acha?