ios - Creating a swipe-able app intro screen -
i'm trying replicate effect done in this gif.
i'm thinking done uipangesturerecognizer, i'm not sure. thanks!
this can accomplished quite uipangesturerecognizer. use translationinview find out how user's finger moved by, , move view according finger movement. in example, self refers view controller, view1 view on top want drag.
uipangesturerecognizer* pan = [[uipangesturerecognizer alloc] initwithtarget:self action:@selector(handlepan:)]; [self.view addgesturerecognizer:pan];
and handle it:
-(void)handlepan:(uipangesturerecognizer*)sender { cgfloat xmovement = [sender translationinview:sender.view].x; // movement view1.frame = cgrectoffset(view1.frame, xmovement, 0); // reset translation [sender settranslation:cgpointzero inview:sender.view]; }
Comments
Post a Comment