我正在开发一个使用 SWRevealViewController 类的应用程序。该应用程序到目前为止工作正常,因为我可以点击左侧栏按钮项以显示后视图控制器,但是当我在前视图控制器中添加手势识别器时,SWRevealViewController 为零。我不知道为什么会这样,任何帮助都将不胜感激。
//not nil here.
SWRevealViewController *revealController = [self revealViewController];
//somehow it becomes nil on the very next line and from then on I can't hold the reference to it
[self.navigationController.navigationBar addGestureRecognizer:[revealController panGestureRecognizer]];
UIBarButtonItem *revealButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"reveal-icon.png"]
style:UIBarButtonItemStyleBordered target:revealController action:@selector(revealToggle:)];