【发布时间】:2013-09-26 09:30:19
【问题描述】:
我有一个自定义控件,其中包含一排按钮,模仿标签栏。当UINavigationController 导航离开根视图控制器时,此控件滑出视图,并在导航到根时滑回。
在 iOS 7 中,UIScreenEdgePanGestureRecognizer 提供滑动返回手势。因此,我正在修改我的自定义控件,以便滑动量对应于UIScreenEdgePanGestureRecognizer 的翻译。
问题是,当用户释放触摸时,我如何判断UINavigationController 是导航回还是弹回原始视图?
[self.interactivePopGestureRecognizer addTarget:self action:@selector(panningBack:)];
- (void) panningBack:(UIPanGestureRecognizer *)recognizer
{
// Snipped - Code that reads the recognizer translation and adjust custom control y position
if (recognizer.state == UIGestureRecognizerStateEnded)
{
// Question: Does it go back, or does it not?
// If it goes back, slide custom control into view
// Else slide custom control out of view
}
}
【问题讨论】:
标签: iphone ios objective-c uinavigationcontroller ios7