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