Basic knowledge of ios:
XCode: You can regard it as a development environment, just like Visual Studio, Netbeans, or SharpDevelop. You can think of Interface Builder as a separate program that is used to draw interfaces in Visual Studio.
Objective-C: This is a language, as if c ++ is a language, Java is a language, c # is a language, and the history of Yingge is also a language.
Cocoa: There are a lot of function libraries, such as MFC,. NET, and Swing. People have already written a bunch of ready-made stuff. You only need to know how to use it.
Some may confuse Objective-C and Cocoa, as if some may confuse c # And. NET. These two things are actually two different things.
Object-c Knowledge:
1. Role of minus signs
Declaration method. obj has no permissions such as public and private.
+ Indicates static, which can be called without instantiation.
Java:
Public void hello (boolean isHello ){
//
}
Obj statement:
-(Void) hello :( BOOL) isHello {
//
}
2. brackets (call method)
This is self in obj, and yes, no is used in Boolean.
Java:
This. hello (true );
Obj:
[Self hello: YES];
3. NS, UI, CA, and so on start with a written function library. You can call it.
NSLog (@ "% d", myInt );
4. nil indicates null.
5, # import is equivalent to importing a package
# Improt and # include are the same
6, @ interface
Obj is implemented after being declared first. The H file declaration, @ interface + @ end, and m file implementation @ implementation + @ end. Isn't it troublesome?
Java:
public class Bird extends Animal{private string name = "tom"private bool isDie(){return true;}}
Obj:
Write a Bird. h file first.
@interface Bird :NSObject {NSString *name;}-(BOOL) isDie;@end
Write another Bird. m file.
#import "Bird.h"@implementation Bird-(void) init{name = @"tom";}-(BOOL) isDie{return YES;}@end
7 multi-parameter Methods
Java:
Public void eat (int count, String name ){
}
Call: this. eat (3, "frog ");
Obj:
Definition
-(Void) eat :( int) count second :( NSString *) name;
Implementation:
-(Void) eat :( int) count second :( NSString *) name {
//
};
Call: [self eat: 3 second @ "frog"]; why is it so troublesome ??
They are all object-oriented languages. They used to learn java. If you have any mistakes, please correct them.