ios - For some reason the method DidBeginEditing: (UITextField *)textfield is not working -


i'm trying move view when keyboard shows wont cover screen, reason -(void)didbeginediting: (uitextfield *)textfield not working.

- (void)textfielddidbeginediting:(uitextfield *)ga1 {     /* should move views */     self.view.center = cgpointmake(self.view.center.x, self.view.center.y + 220); }  - (void)textfielddidendediting:(uitextfield *)ga1 {     /* should move views */     self.view.center = cgpointmake(self.view.center.x, self.view.center.y - 220);  } 

its nor going method, can tell me why?

in interface of class add line , in .m file put above says @implementation...

@interface myclassname () <uitextfielddelegate>  // properties can go here  // example dragging iboutlet textfield storyboard @end 

you in viewdidload should set delegate of uitextfield so...

-(void)viewdidload {  // whatever code  self.textfield.delegate = self; } 

alternatively, , more cleanly, can in story board control clicking text field , dragging indicator view controller class icon (the icon furthest left) in lower bar.

also, why calling argument textfield in implementation "ga1"? best practice should call it

 - (void)textfielddidbeginediting:(uitextfield *)textfield 

one final note if have multiple textfields should set delegate each of them in way described above. why storyboard way of doing "cleaner," because keeps having multiple delegate declarations in code.


Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -