AP102 2016/5/9 delegate
#import "ViewController.h"
@interface ViewController ()<UITextFieldDelegate>
**@property (weak, nonatomic) IBOutlet UITextField *UItextField;**//step1
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
**self.UItextField.delegate = self;**//step2
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
//step3
**-(BOOL)textFieldShouldReturn:(UITextField *)textField
{
[textField resignFirstResponder];//resignFirstResponder
//第一回應人預設會升起鍵盤,提高回應優先權
return YES;
//UIResponderChain
//hitTesting
}**
@end
Comments
Post a Comment