我是 iPhone iOS 开发的新手。我无法关闭键盘,没有任何效果。请帮助我,也许我没有注意到什么?
我的 .h 文件:
#import "UIKit/UIKit.h"
@interface ViewController : UIViewController <UITextViewDelegate>
@property (weak, nonatomic) IBOutlet UITextField *textField;
@end
我的 .m 文件:
#import "ViewController.h"
#import "UIKit/UIKit.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
-(BOOL) textFieldShouldReturn: (UITextField *) textField{
[textField resignFirstResponder];
return YES;
}
@end