简体   繁体   中英

Tap a view below a tableview that has a top content inset

Is it possible to click a table with a content inset to tap the view below it?

Here is the setup:

2 tables view controllers on top of each other.

Top Table Bottom Table

Top table background is transparent with a top content inset revealing the bottom table.

[self.tableView setContentInset:UIEdgeInsetsMake(150,0,0,0)];

When the top table is scrolled all the way down, it does successfully reveal the bottom table view.

However, the bottom table can not receive touch events.

Is it possible to somehow make it clickable? (the cells?)

Thank you in advanced!

This was solved fairly quickly by subclassing the top container and responding with NO if the click was between the empty space.

(BOOL) pointInside:(CGPoint)point withEvent:(UIEvent *)event

Also need to ensure that the table was also not scrolled up by checking it's contentOffset

    if (point.y < topPadding)   
    {
        if ((tableView.contentOffset.y * -1) >= topPadding)
        {
            // Point was inside the empty space of the tableview
               return NO;
        }
    }

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