当前位置: 动力学知识库 > 问答 > 编程问答 >

ios - UIView with UITableView and UIGestureRecognizer stops Gesture-Recognizing suddenly

问题描述:

My App has a view containing a UITableView. I added a UIPanGestureRecognizer to the view.

I use the GestureRecognizer for adjusting the TableViews width.

When the TableView´s width is adjusted, the cells within the table are also autoresized.

First this works very well. - After some resizes suddenly the GestureRecognizer doesn´t fire anymore. Within another view-region (other than the tableView) the GestureRecognizer still works fine.

Do I rotate the device, the GestureRecognizer starts working again for a while.

I have the same situation with a UICollectionView instead of the TableView - there works everything fine.

Any hints for solving the problem?

网友答案:

I figured out following approach, which works fine for me.

I added the UIGestureRecognizerDelegate-Protocol to my ViewController and added the following function:

-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer{
    return YES;
}
分享给朋友:
您可能感兴趣的文章:
随机阅读: