@selector parameter delivery for iOS development

Source: Internet
Author: User

Like what:

Nsmutabledictionary *dic = [[Numutabledictionary alloc]init];

[dic setvalue:@ "haha" forkey:@ "test"]

[Nstimer scheduledtimerwithtimeintervatal:2.0 target:self selector:

@selecrtor (onTimer:) userinfo:dic Repeats:no];

On the above call OnTimer: How to pass arguments, there may be a question here, I only know the method name, how do I know what type of argument to pass. In fact, it is very simple to pass the parameters of the Nstimer object, from the object of the Nstimer object can get the userinfo in the DIC, so as to remove the data in DIC.

Therefore, OnTimer: the implementation of the method must be as follows (the parameter must be of type OnTimer):

-(void) OnTimer: (Nstimer *) timer{

.............................

}

@selector parameter delivery for iOS development

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.