OC中+方法的定义: +方法可以直接用类名可调,不需要创建对象
+(BOOL)返回值类型
(NSString *)identityString 传入值类型
+ (BOOL)judgeIdentityStringValid:(NSString *)identityString;
swift +放的使用
->
CGFloat 返回值类型,
height()方法名,()中为所传的参数 使用:
例如: tableView: UITableView tableView对象名字,UITableView 为类名
public static func height() -> CGFloat{
return 0.3*kScreenWidth
}
OC中的-方法:-方法 由对象,和本类可调
-(BOOL) 返回值类型,
(NSDictionary *)dic 参数类型
-(BOOL)returnData:(NSDictionary *)dic;
swift中的-方法
func name(parameters) -> return type {
function body
}
name :为方法名,
parameters:为参数名
type:为返回值类型
function body:为你要处理的方式