Some Notes on learning iOS development

Source: Internet
Author: User

About the +-symbol before the method

The preceding plus (+) method is a class method, which can be called directly with the class name, and it is primarily a function of creating an instance. Equivalent to a static method.

The preceding minus (-) method is an instance method that must be used by an instance of the class to invoke.

To declare a member variable static, you must use the static keyword


On the parameter problems of the function of Ob-c

A method of object-c can contain more than one parameter, except for the first argument, and all subsequent arguments are written with a name.
How to do multiple parameters

(The data type of the method) function name: (parameter 1 data type) parameter 1 of the numeric value of the first name of parameter 2: (Parameter 2 data type) parameter 2 value name ...;

As an example, the definition of a method:

-(void) Setkids: (NSString *) myoldestkidname secondkid: (NSString *) mysecondoldestkidname thirdkid: (NSString *) MyThird Oldestkidname;

When implementing this function:

-(void) Setkids: (NSString *) myoldestkidname secondkid: (NSString *) mysecondoldestkidname thirdkid: (NSString *) MyThird oldestkidname{

The older son = Myoldestkidname;

two sons = Mysecondoldestkidname;

three sons = Mythirdoldestkidname;

}

When called:

Kids *mykids = [[Kids alloc] init];

[Mykids setkids: @ "Zhang vigorously" secondkid: @ "Zhang Yili" Thirdkid: @ "Zhang Xiao Li"];

And if you write this method in C #, the general wording might be

public void Setkids (string myoldestkidname, String mysecondoldestkidname, String mythirdoldestkidname)

{

...

}

The approximate wording of the call might be:

Kids mykids = new Kids ();

Mykids.setkids ("Zhang vigorously", "Zhang Yili", "Zhang Xiao Li");

Do you understand? It's not really ugly.

Basically, if you can understand the conversion relationship of the following code, your OBJECTIVE-C syntax will understand 80%:

[[[[MyClass alloc] Init:[foo Bar]] autorelease];

The syntax for converting to C # or Java is:

Myclass.alloc (). Init (Foo.bar ()). Autorelease ();

Internet news: A little thing about the internet www.yidin.net

Some Notes on learning 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.