1.NS is the system library.
2.IOS class declaration:
@interface MyObject : NSObject {
int memberVar1; // entity variable
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, which can be used without an instance. The same as c++
declaration interface Begin, end end.
3. IOS String:
NSString* myString = @"My String\n";
NSString* anotherString = [NSString stringWithFormat:@"%d %s", 1, @"String"];
// from A C language string creates an Objective-C string
NSString* fromCString = [NSString stringWithCString:"AC string"
encoding:NSASCIIStringEncoding];
@ is a mnemonic,Objects can be created from constant strings using mnemonics.
4. IOS class implementation @implementation
MyObject {
int memberVar3; //private entity variable
}
+(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. The usage of square 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. Not commonly used
IOS rookie learning
Guess you like
Origin http://43.154.161.224:23101/article/api/json?id=325257402&siteId=291194637
Recommended
Ranking