ios - Adding gesture recognizer control to JTRevealSideBarDemoV2 -


i using jtrevealsidebardemov2 implementation of side panels facebook , path application. have configured in every sense , want add 1 more feature library. want apply gesture recognizer control in library similar facebook. can help?

the link downloading library is:-https://www.cocoacontrols.com/controls/jtrevealsidebar

thanks!

@wattson:- code have added implementing gesture recognizer. bbut behaving abnormally. if have downloaded code jtrevealsidebardemov2 can analyze code have written for.

the code is:

        (void)setupgestures{     uipangesturerecognizer *panrecognizer = [[uipangesturerecognizer alloc]    initwithtarget:self action:@selector(movepanel:)];    [panrecognizer setminimumnumberoftouches:1];     [panrecognizer setmaximumnumberoftouches:1];     [panrecognizer setdelegate:self];        [self.view addgesturerecognizer:panrecognizer];       }       -(void)movepanel:(id)sender {         [[[(uitapgesturerecognizer*)sender view] layer] removeallanimations];           cgpoint translatedpoint = [(uipangesturerecognizer*)sender         translationinview:self.view];         cgpoint velocity = [(uipangesturerecognizer*)sender velocityinview:[sender view]];         if([(uipangesturerecognizer*)sender state] == uigesturerecognizerstatebegan) {     //uiview *childview = nil;      if(velocity.x > 0) {         if (!jtrevealedstateright) {              [self revealleftsidebar:(uipangesturerecognizer *)sender];         }     } else {         if (!jtrevealedstateleft) {              [self revealrightsidebar:(uipangesturerecognizer *)sender];         }      }     // make sure view you're working front , center.     //[self.view sendsubviewtoback:];     [[sender view] bringsubviewtofront:[(uipangesturerecognizer*)sender view]]; }  if([(uipangesturerecognizer*)sender state] == uigesturerecognizerstateended) {      if(velocity.x > 0) {         // nslog(@"gesture went right");     } else {         // nslog(@"gesture went left");     }      if (!_showpanel) {         [self revealleftsidebar:(uipangesturerecognizer *)sender];     } else {         if (jtrevealedstateleft) {             [self revealrightsidebar:(uipangesturerecognizer *)sender];         }  else if (jtrevealedstateright) {             [self revealleftsidebar:(uipangesturerecognizer *)sender];         }     } }  if([(uipangesturerecognizer*)sender state] == uigesturerecognizerstatechanged) {     if(velocity.x > 0) {         // nslog(@"gesture went right");     } else {         // nslog(@"gesture went left");     }      // more halfway? if so, show panel when done dragging setting       value yes (1).     _showpanel = abs([sender view].center.x - self.view.frame.size.width/2) >        self.view.frame.size.width/2;      // allow dragging in x-coordinates updating x-coordinate      translation position.     [sender view].center = cgpointmake([sender view].center.x + translatedpoint.x, [sender       view].center.y);     [(uipangesturerecognizer*)sender settranslation:cgpointmake(0,0) inview:self.view];      // if needed check change in direction, use code so.     if(velocity.x*_prevelocity.x + velocity.y*_prevelocity.y > 0) {         // nslog(@"same direction");     } else {         // nslog(@"opposite direction");     }      _prevelocity = velocity; } 

}


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

c# - must be a non-abstract type with a public parameterless constructor in redis -

ajax - PHP/JSON Login script (Twitter style) not setting sessions -