iphone - - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {} is not working -
i called method,
- (void)touchesbegan:(nsset *)touches withevent:(uievent *)event { [super touchesbegan:touches withevent:event]; [self.name resignfirstresponder]; [self.username resignfirstresponder]; [self.mailid resignfirstresponder]; [self.password resignfirstresponder]; [self.retypepassword resignfirstresponder]; }
for purpose of resign first responder.it working without using scrollview.but if using scrollview cant able use method.why?
you can add gesture recognizer if need use scrollview. try this:
uitapgesturerecognizer *gesturerecognizer = [[uitapgesturerecognizer alloc] initwithtarget:self action:@selector(resignfirstresponder:)]; gesturerecognizer.delegate = self; [scrollview addgesturerecognizer:gesturerecognizer]; -(void) resignfirstresponder:(uitapgesturerecognizer *) gesture { [self.name resignfirstresponder]; [self.username resignfirstresponder]; [self.mailid resignfirstresponder]; [self.password resignfirstresponder]; [self.retypepassword resignfirstresponder]; }
there many more alternatives: see uiscrollview prevents touchesbegan, touchesmoved, touchesended on view controller , uiscrollview touchesbegan
Comments
Post a Comment