iob*_*boi 6 cocoa-touch objective-c uigesturerecognizer uipageviewcontroller
在我的应用程序中,我有一个RootPageViewController,它包含UIPageViewController和一个或多个DetailPageViewController,UITableView作为子视图.
DetailPageViewController
/
RootPageViewController - DetailPageViewController
\
DetailPageViewController
Run Code Online (Sandbox Code Playgroud)
在每个DetailPageViewController的顶部是一个小空间,应该可以滑动并转到下一个DetailPageViewController.
-------------------
| |
| | -> UIPageViewController should respond to pan's
| |
|-------------------| --------------------------------------------
| CellContent |
|-------------------|
| CellContent |
|-------------------| -> UIPageViewController should disable UIPageViewController pan's
| CellContent |
|-------------------|
| ... |
Run Code Online (Sandbox Code Playgroud)
在iOS 7天气应用程序是一个滚动视图与整个弱预测谁不知何故覆盖或禁用UIPageViewController的平底锅.
我该如何重现这种行为?
很抱歉找不到截图
我通过子类化 UIPageViewController、找到其 UIScrollView(迭代 self.subviews)并向该滚动视图添加新的 UIPanGestureRecognizer 来完成此操作。
我将子类 UIPageViewController 设置为新 UIPanGestureRegognizer 的委托。然后我实现两个委托方法:
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
{
return NO;
}
Run Code Online (Sandbox Code Playgroud)
并在
- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer
Run Code Online (Sandbox Code Playgroud)
我决定是否要“吃掉该事件”(回答“是”),或者是否希望 UIScrollView 的原始 UIPanGestureViewRecognizer 来处理它(回答“否”)。因此,YES 回复意味着 UIPageViewController 将不会滚动到下一个 ViewController。
| 归档时间: |
|
| 查看次数: |
1713 次 |
| 最近记录: |