//在页面加载前
-(void)loadView
{
//将ViewContrller中的View变为UIContrl的对象
UIControl *control = [[UIControl alloc]initWithFrame:[UIScreen mainScreen].bounds];
[self setView:control];
}
//添加点击View页面的事件
UIControl *control = self.view;
//设置背景色
self.view.backgroundColor = [UIColor whiteColor];
[control addTarget:self action:@selector(resignView) forControlEvents:UIControlEventTouchUpInside];
//点击空白取消编辑状态
-(void)resignView
{
[self.view endEditing:YES];
}