iphone点击空白隐藏键盘

-(void) touchesBegan:(NSSet*)touches withEvent:(UIEvent*)event{

     UITouch*touch =[touches anyObject];

     if(touch.phase==UITouchPhaseBegan){

         //find first response view

         for(UIView*view in[self.view subviews]){

             if([view isFirstResponder]){

                 [view resignFirstResponder];

                 break;

             }

         }

     }

}

原文地址:https://www.cnblogs.com/zzxap/p/2175648.html