這是我的代碼:爲什麼文本字段不能響應隱藏鍵盤?
- (BOOL) textFieldShouldReturn:(UITextField *)textField {
[txtSiteDesc resignFirstResponder];
[txtDesc resignFirstResponder];
[ssFS resignFirstResponder];
return YES;
}
這是.h文件:
#import <UIKit/UIKit.h>
@interface slEnterDataViewController : UITableViewController <UITextFieldDelegate> {
UITextField *txtSiteDesc;
UITextField *txtDesc;
UITextField *ssFS;
}
@property (nonatomic, retain) IBOutlet UITextField *txtSiteDesc;
@property (nonatomic, retain) IBOutlet UITextField *txtDesc;
@property (nonatomic, retain) IBOutlet UITextField *ssFS;
@end
它的工作原理爲txtSiteDesc,而不是任何其他人。我假設問題出在textFieldShouldReturn方法中;我想我可以檢查「textField」的值來查看它是哪個字段,然後執行適當的「resignFirstResponder」並返回。我很接近(我認爲)但還不夠接近。
幫助將不勝感激。 :D
非常感謝你......現在就像一個冠軍!我感謝你的幫助...:D – SpokaneDude 2012-03-10 02:33:46