iOS Newbie Learning

Source: Internet
Author: User

1.NS is the system library.
Declaration of the 2.IOS class:
@interface Myobject:nsobject {
int memberVar1; Entity variables
ID memberVar2;
}

+ (return_type) Class_method; Class method

-(return_type) instance_method1; Instance method
-(Return_type) INSTANCE_METHOD2: (int) P1;
-(Return_type) instance_method3: (int) p1 ANDPAR: (int) P2;
@end

+: Represents a class function and does not require an instance to be used. Same as C + +
Declaration interface begins and end ends.
3.IOS string:
nsstring* myString = @ "My string\n";
nsstring* anotherstring = [NSString stringwithformat:@ "%d%s", 1, @ "String"];

Create a objective-c string from a C-language string
nsstring* fromcstring = [NSString stringwithcstring: "A C string"
Encoding:nsasciistringencoding];

@ is a mnemonic that allows you to create an object with a constant string.

Implementation of the 4.IOS class
@implementation MyObject {
int memberVar3; Private physical variables
}

+ (Return_type) Class_method {
.....//method implementation
}
-(Return_type) instance_method1 {
....
}
-(Return_type) INSTANCE_METHOD2: (int) P1 {
....
}
-(Return_type) instance_method3: (int) p1 ANDPAR: (int) P2 {
....
}
@end

Implementation starts, end ends.

5. Use of brackets [class name class method] or [object instance method]

[Vlpaproxyhelper Moreplaylist:listdic] Vlpaproxyhelper Class name Moreplaylist class method Listdic parameter

6.id is an object pointer that can be converted to any data type. Infrequently used

iOS Newbie Learning

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.