Monday, 15 April 2013

ipad - Swipe gesture not working when adding as subview ios sdk -



ipad - Swipe gesture not working when adding as subview ios sdk -

i spent entire weekend trying figure out why gestures not working. when nowadays model view gestures working when add together subview gestures not working. there reason why not working when added subview.

this code works:

myvc = [[fullviewcontroller alloc] initwithnibname:@"fullviewcontroller" bundle:nil]; uinavigationcontroller *navigationcontroller = [[uinavigationcontroller alloc] initwithrootviewcontroller: myvc]; navigationcontroller.modalpresentationstyle = uimodalpresentationformsheet; [self presentmodalviewcontroller:navigationcontroller animated:yes]; navigationcontroller.view.superview.bounds = cgrectmake(0,0,1024,724);

this code not work:

myvc = [[fullviewcontroller alloc] initwithnibname:@"fullviewcontroller" bundle:nil]; myvc.view.frame = cgrectmake(0, 0, 1024, 724); mynavctrl = [[uinavigationcontroller alloc] initwithrootviewcontroller:myvc]; [self.view addsubview: mynavctrl.view]; mynavctrl.view.frame = cgrectmake(0, -20, 1024, 675);

gesturerecognizer code:

swipeleft = [[uiswipegesturerecognizer alloc] initwithtarget:self action:@selector(handleswipeleft:)]; [swipeleft setdirection:uiswipegesturerecognizerdirectionleft]; [self.view addgesturerecognizer:swipeleft];

any help apprenticed.

looks me superview not allowing touches or user interaction. can't why code snippet provide, can seek adding gesture recognizer superview , see if works, if doesn't problem superview.

it works modal because not utilize other view @ all.

ios ipad uigesturerecognizer subview

No comments:

Post a Comment