iOS 15th day (2, event handling HitTest exercise)

Source: Internet
Author: User

HitTest get the most appropriate point

@implementationHmgreenview- (void) Touchesbegan: (Nsset *) touches withevent: (Uievent *)Event{NSLog (@"%s", __func__);} get a view of the most appropriate point //-(UIView *) HitTest: (cgpoint) point withevent: (Uievent *) event//{//    //put your point on the DOT conversion button on the coordinate system//Cgpoint buttonpoint = [self convertpoint:point toview:_button];//    //if ([_button pointinside:buttonpoint withevent:event]) return nil; I'm not the most appropriate point. ////    //return [Super Hittest:point withevent:event];//}//Judging is not the most appropriate point-(BOOL) Pointinside: (cgpoint) point withevent: (Uievent *)Event{    //converts a point on the left control to a point on the right top control//Cgpoint buttonpoint = [self convertpoint:point Toview:_button]; //convert from the point on the right view to the point on the coordinateCgpoint Buttonpoint =[_button convertpoint:point fromview:self]; if([_button pointinside:buttonpoint withevent:Event])returnNO; //oneself is not the most suitable point return[Super Pointinside:point Withevent:Event];}@end

iOS 15th day (2, event handling HitTest exercise)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.