![](/img/trans.png)
[英]Is it possible to disable the swipe gesture and only make the pan gesture work in a scrollview?
[英]Is it possible to start scrollView pan gesture on a button
我有一個像這樣的層次結構
- UIView
- UITableView
- UIButton
默認情況下,從UIButton滑動不會滾動滾動視圖。 我想改變它,所以它確實如此。
我可以通過將UIButton
更改為UILabel
並向其添加UITapGestureRecogniser
來有效地創建自定義按鈕。
有沒有辦法保持它作為UIButton?
-(void)moveUpView
{
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:n inSection:0];
[self.tableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionTop
animated:YES];
}
希望這可行
創建一個重復的UITableView
(具有相同的dataSource
和delegate
),但不要將其插入到視圖層次結構中的任何位置; 只需將其panGestureRecognizer
添加到UIButton
。 實現其委托-scrollViewDidScroll:
方法,將原始UITableView
的contentOffset
設置為重復的UITableView
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.