-(void) viewdidload { [super viewdidload]; Additional setup after loading the view, typically from a nib. Uitextfield *textfield=[[uitextfield Alloc]initwithframe:cgrectmake (Ten, +, ())]; Textfield.backgroundcolor=[uicolor Redcolor]; [Self.view Addsubview:textfield]; } The first method of collecting the keyboard-(void) Touchesbegan: (Nsset *) touches withevent: (uievent *) event{ [Self.view endediting:yes];} The second method of collecting the keyboard-(void) Touchesbegan: (Nsset *) touches withevent: (uievent *) event{ [[UIApplication sharedapplication ] SendAction: @selector (resignfirstresponder) To:nil from:nil Forevent:nil];} The third method of collecting the keyboard-(void) Touchesbegan: (Nsset *) touches withevent: (uievent *) event{ [[UIApplication] Sharedapplication] Keywindow] endediting:yes];}
Ios-three ways to pick up the keyboard