0

私は大きな問題を抱えています。私のアプリでは、テキストフィールドに触れると、キーボードの上に表示され、テーブルビューが上にスクロールし、テーブルビューにも画像が表示されます。

それはうまくいきます。しかし、リターンキーを使用すると、テーブルビューもテキストフィールドを下にスクロールしますが、スクロールすると画像が大きくなり、画像が正しいサイズに戻ります

リターンキーのコード:

-(BOOL)textFieldShouldReturn:(UITextField *)textField {

[messageField resignFirstResponder];
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.3];
toolbar.frame = CGRectMake(0, 323, 320, 44);
dialogueTb.frame = CGRectMake(0, 0, 320, 372);
[UIView commitAnimations];
return YES;

}

編集:

textFieldShouldReturn で問題が見つかりました:

私がこれをしても問題ありません:

 -(BOOL)textFieldShouldReturn:(UITextField *)textField {

[messageField resignFirstResponder];
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.3];
toolbar.frame = CGRectMake(0, 323, 320, 44);
[UIView commitAnimations];<<====================== change place
dialogueTb.frame = CGRectMake(0, 0, 320, 372);
//[UIView commitAnimations] 
return YES;
}
4

1 に答える 1

0

私の推測では、UIImageViewのautoresizingMaskと関係があると思います。これを試して:

imageView.autoresizingMask = UIViewAutoresizingNone;
于 2012-07-25T00:48:36.667 に答える