//注册通知
-(void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
//键盘出现
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];
//键盘回收
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil];
}
//移除通知
-(void)viewDidDisappear:(BOOL)animated{
[super viewDidDisappear:animated];
[[NSNotificationCenter defaultCenter]removeObserver:self];
}
//键盘出现
- (void)keyboardWillShow:(NSNotification *)notification
{
//获取处于焦点中的view
NSArray *textFields = @[_people_num, _scale,_leader_name,_leader_phoneNum]; //将需要上移的控件存在这个数组
UIView *focusView = nil;
for (UITextField *view in textFields) {