ios - two taps to full and two tap the screen to return to normal -


i want have 2 taps make full screen , 2 taps return regular. however, 2 gesturerecognizers conflicting , both getting called resulting in screen not changing. how fix that?

here code:

-(void) tap2full {          //teste apartir daqui "tap"     uitapgesturerecognizer *fullscreen = [[uitapgesturerecognizer alloc] initwithtarget:self action:@selector(fullscreen)];     fullscreen.numberoftapsrequired = 1;      uitapgesturerecognizer *screenout = [[uitapgesturerecognizer alloc] initwithtarget:self action:@selector(screenout)];     screenout.numberoftapsrequired = 2;      // stops taponce overriding taptwice     [fullscreen requiregesturerecognizertofail:screenout];      fullscreen.delegate = self;     screenout.delegate = self;      [self.webview addgesturerecognizer:fullscreen];     [self.webview addgesturerecognizer:screenout];  }  - (void)fullscreen {      self.navigationcontroller.navigationbar.layer.zposition = -1;     [self.view bringsubviewtofront:self.webview];     self.webview.frame = cgrectmake(self.view.frame.origin.x, self.view.frame.origin.y, self.view.frame.size.width, self.view.frame.size.height);     self.webview.layer.zposition = 9;     [[uiapplication sharedapplication] setstatusbarhidden:yes];  }  - (void)screenout {     self.navigationcontroller.navigationbar.layer.zposition = 1;     self.webview.frame = cgrectmake(self.view.frame.origin.x, 113, 320, 455);     [[uiapplication sharedapplication] setstatusbarhidden:no];  } 

i have changed in code. please hope work you.

//global bool flag  bool istaponscreen;  -(void) tap2full {          istaponscreen = true;     //teste apartir daqui "tap"     uitapgesturerecognizer *fullscreen = [[uitapgesturerecognizer alloc] initwithtarget:self action:@selector(fullscreen)];     fullscreen.numberoftapsrequired = 2;     fullscreen.delegate = self;     [self.webview addgesturerecognizer:fullscreen]; }  - (void)fullscreen {     if(istaponscreen == false) {            self.navigationcontroller.navigationbar.layer.zposition = 1;           self.webview.frame = cgrectmake(self.view.frame.origin.x, 113, 320, 455);           [[uiapplication sharedapplication] setstatusbarhidden:no];           istaponscreen = true;     }     else {          self.navigationcontroller.navigationbar.layer.zposition = -1;          [self.view bringsubviewtofront:self.webview];          self.webview.frame = cgrectmake(self.view.frame.origin.x, self.view.frame.origin.y, self.view.frame.size.width,    self.view.frame.size.height);          self.webview.layer.zposition = 9;          [[uiapplication sharedapplication] setstatusbarhidden:yes];          istaponscreen = false;    } } 

thanks.. :)


Comments

Popular posts from this blog

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

python - build a suggestions list using fuzzywuzzy -