欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

iOS push側(cè)滑返回功能實(shí)現(xiàn)方法

 更新時(shí)間:2018年05月11日 16:15:34   作者:jingwei卍  
這篇文章主要為大家詳細(xì)介紹了iOS push側(cè)滑返回功能實(shí)現(xiàn)方法,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

本文實(shí)例為大家分享了iOS push側(cè)滑返回功能的具體代碼,供大家參考,具體內(nèi)容如下

開啟iOS自帶的push的側(cè)滑返回功能(只有左側(cè)邊緣地帶響應(yīng)側(cè)滑返回,并不是全局響應(yīng)):

- (void)viewWillAppear:(BOOL)animated
{
 [super viewWillAppear:animated];
 if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0) {
  [self.navigationController.interactivePopGestureRecognizer setEnabled:YES];
  self.navigationController.interactivePopGestureRecognizer.delegate = self;
 }
}

為防止導(dǎo)航控制器在根視圖時(shí)觸發(fā)手勢(shì)

- (BOOL)gestureRecognizerShouldBegin:(UIPanGestureRecognizer *)gestureRecognizer {
 if (self.childViewControllers.count == 1) {
  return NO;
 } else {
  return YES;
 }
}

這樣 在根視圖側(cè)滑返回操作,然后出發(fā)push會(huì)沒有效果,界面會(huì)卡住;代碼已經(jīng)push到下一個(gè)VC,但界面還停留在根視圖。

解決方法是在根視圖添加如下代碼:

-(void)viewDidAppear:(BOOL)animated{
 [super viewDidAppear:animated];
 if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0) {
  self.navigationController.interactivePopGestureRecognizer.enabled = NO;
 }
}

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

最新評(píng)論