Large sample

1 Taobao logistics interface

2 drops

3 I wrote it myself

The origin of

Taobao for me, has not been to the logistics interface for a long time, because I do not care about. In my impression, this interface is still based on the logistics information returned by the interface to do interface display. That day, a friend suddenly asked me: “Do you know taobao’s logistics interface is how to do?” I thought it was amazing. I thought the map above was a headerView for tableView. My friend told me it wasn’t. May be because feel answer of not very good, I perfunctory say :” you have this demand?” It was his colleague’s project that needed it. After this matter is not solved……. About three days later, he told me that the interface was almost done, and he found a demo on Google, and I looked at the results. Pretty much the same. So I started writing this little sample. The purpose is not to show off what, I estimate that many people will also, so hope, do not like spray…….

The key of problem

After I saw the demo, the key is to determine which view to click on. – (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event;

Related knowledge links

  1. IOS Knowledge collection No. 15 · Nuggets debut
  2. Understanding UIView hitTest: withEvent: method
  3. Click event handler, and hitTest:withEvent: implementation

action

The structure of my demo was pretty simple. First of all, we made a MapView that was a whole screen size; Then I add a tableView, which is the size of the screen, and I do that with the contentInset; This completes the layout of the interface. And then it’s just a matter of implementing that method, so I’m going to customize a tableView and implement that method in there

- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
    id hitView = [super hitTest:point withEvent:event];
    if (point.y<0) {
        return nil;
    }
    return hitView;
}
Copy the code

So we’ve solved the slide problem for the map and the slide problem for the tableView

There is still a mystery, ask god to give directions

Taobao that map route that, will always be displayed above, and my reality of this demo has always been in the center of the entire MapView, and when sliding, can also follow the east China offset to do the corresponding adjustment, there are big god know welcome to know little brother.

portal

Demo