1.常见的文件扩展名
.c C语言源文件、.cc,.cpp C++ 语言源文件 .h 头文件 .m objective-c 源文件 .mm objective-c++源文件 .pl perl源文件 .o object(已编译的)文件
2.main函数是整个程序执行的入口
3.NSAutoreleasePool * pool = [[NSAutoreleasePool] alloc] init] 自动释放池,[pool drain]释放已分配的内存池
4.NSLog(@"1"); 此处的@必须在双引号字符串前。称为NSString 对象。
5.基本数据类型:int类型、float类型、double类型、char类型、id类型[%i、%f、%e、%g、%c]
6.限定词:long、longlong、short、unsigned、signed
7.模运算符(%)(NSLog("%%") 输出 %)
8.各种数据类型相互转换(int)(float)(double)
9.位运算符:&(按位与)|(按位或)^(按位异或)~(一次求反)<<(向左移位)>>(向右移位)
10._Bool _Complex _Imaginary
11.循环结构
for语句、while语句、do语句[其用法同c语言]
break、continue
12.NSLog\scanf\sprintf
13.选择结构
if语句(if语句、else语句、elseif语句)、switch语句、conditional运算符
类
1.classname *a = [[classname alloc] init]; 和 classname *b=[classname new];是一样的,但是更加推荐前面的声明方式,后面的这种方式主要是为了兼容性还有熟悉性而存在的。
2.类中方法的调用 [a methodname]
3.@interface
4.导入类的 #import classname.h
5.- 和 +
6.@implementation
7.设置函数setter 和获取函数 getter
方式一
-(int)setter{return setter;}
-(int) getter{return getter}
[newclassname getter]
方式二
@property setter,getter;
@sys。。。 setter,getter;
newclassname.setter newclassname.getter
8.#import classname.h引入外部类
9.多参数的方法
方法一:classname methodname:(int)n methodname2:(int)d
调用方法:[newclassname methodname:1 methodname2:2]
方法二:classname methodname:(int)n:(int)d
调用方法:[newclassname methodname 1:2];
10.关键字:self、statics