简体   繁体   中英

Scrolling issue in nested UITableview in iOS

I'm creating a layout where the data should scroll vertically and each rows data should scroll vertically. To accomplish this I have used UITableView as parent and inside each UITableViewCell , I am adding UITablview for vertical scroll.

The parent UITableView has only two section, each section has child UITableView . The Child tableView has more than 50 rows. I am facing scrolling issue. I want that the child UITableView scrolls only when the respective section reaches to top of the screen. Now the behaviour is it scrolls independentaly.

How we can achieve this?

您必须创建内部UITableView的自定义子类,并根据您的条件覆盖以下方法并返回true / false:

touchesShouldBegin(_:with:in:)

Try by setting following property to the main table view.

self.tableView!.delaysContentTouches = true
self.tableView!.canCancelContentTouches = true

Another option is, Use TableView inside CollectionView

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM