内联函数

内联函数:替换宏定义函数,并且会检查数据类型.

static inline 或者 UIKIT_STATIC_INLINE)进行定义
在.h或者.m替换之前宏定义的位置

1
2
3
4
5
6
7
8
9
10
11
返回值 函数名(参数1,参数2){
//其他操作
return xxx;
}
//例子
static inline CGFloat WindowHeight(){
return [UIScreen mainScreen].bounds.size.height;
}
UIKIT_STATIC_INLINE CGFloat WindowWidth(){
return [UIScreen mainScreen].bounds.size.width;
}

end