0

如何将平移手势添加到视图的前半部分(0,0,160,480),并在同一视图上添加滑动手势(160,0,160,480)?

视图是表格视图,向左滑动单元格内容应该改变,向右平移表格视图应该像 facebook ios 应用程序一样移动

4

1 回答 1

2

将两个不同的 UIview 作为具有所需帧大小的 mainView 的子视图,然后添加所需的手势:-

 UISwipeGestureRecognizer *swipeGestureRecognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeVC:)];
    swipeGestureRecognizer.delegate = self;
    [self.subView.view addGestureRecognizer:swipeGestureRecognizer];

    UIPanGestureRecognizer *panGestureRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(panVC:)];
    panGestureRecognizer.delegate = self;
    [panGestureRecognizer requireGestureRecognizerToFail:swipeGestureRecognizer];
    [self.subView2.view addGestureRecognizer:panGestureRecognizer];

当通过gestureRecognizer 或otherGestureRecognizer 识别手势时调用Below 方法

- (BOOL) gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {
    return YES;
}
于 2012-12-28T11:31:05.427 回答