私は愚かなことに困っています:ナビゲーションバーとテーブルビューを備えたビューを持っています。私のナビゲーション バーには「検索」の左ボタンがあります。ユーザーがこの「検索」ボタンを押すと、テーブル ビューがダウンし、ナビゲーション バーとテーブル ビューの間に検索専用の新しいビューが表示されます。
UITextfield を実装するだけのView Controllerがあります:
#import <UIKit/UIKit.h> @interface serachBox : UIViewController <UITextFieldDelegate> { IBOutlet UITextField *kWTextField; } @end
私の他のView Controllerには私の要素(ナビゲーションバー、テーブルバーなど)があります。検索ボタンを押すときに使用する機能は次のとおりです。
- (void) pressSearchBtn:(id)sender{ [searchBox.view setFrame:CGRectMake(0, -100, 320, 100)]; CGRect theFrame = self.view.frame; [UIView beginAnimations:@"frame" context:nil]; [UIView setAnimationDuration:0.5]; [UIView setAnimationDelegate:self]; [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; theFrame.origin.y = 100; [self.view addSubview:searchBox.view]; self.view.frame = theFrame; [UIView commitAnimations]; }
私の問題 : 検索ボックス ビューは正常に表示されますが、クリックしてもテキスト フィールドが応答しません。私は単純なサブビューの追加を(アニメーションを実行せずに)テストしましたが、うまくいきました。
何か問題でもありますか ?