Objective-c Kit Kat Kinky Tech--delegate Hook

Source: Internet
Author: User

Objective-c Kit Kat Kinky Tech –delegate Hook

Artifice refers to a skill and a product that is too kit and useless.

Requirements Description

In the actual programming process, we always have to customize some of the controls, in the process of customization, sometimes like to implement some of their own delegate method

// MYScrollView.m- (instancetype)init{    ...    self.delegae = self;    ...}- (void)scrollViewDidScroll:(UIScrollView *)scrollView{    NSLog(@"%s 我被执行", __func__);    ...}

It's OK to look at the code above, but what happens when our other objects want to implement delegate?

//  ViewController.m- (void)viewDidLoad {    ...    scrollView.delegate = self;    ...}- (void)scrollViewDidScroll:(UIScrollView *)scrollView{    NSLog(@"%s 执行了ViewController里的方法,就不执行MYScrollView的方法了", __func__);    ...}

Some students in the Viewcontroller method in the call Uiscrollview method, we do not know myscrollview own implementation of those delegate methods Ah, can only be forwarded each.

//  ViewController.m- (void)scrollViewDidScroll:(UIScrollView *)scrollView{    [(MYScrollView *)scrollView scrollViewDidScroll:scrollView];    ...}...

Objective-c Kit Kat Kinky Tech--delegate Hook

Related Article

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.