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

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -