Sha*_*shi 4 methods nsstring ios
我有一个方法,我需要在另一个方法中调用.在UIViewController中
//This is how i call methoed
tmpUITextView.text= [self ssidValue:1 arrayOf:ssidArray];
//my Method
+ (NSString *)ssidValue:(NSInteger)selectedValue arrayOf:(NSMutableArray *)tmpArray {
NSString *result=[tmpArray objectAtIndex:selectedValue];
NSLog(@"%@",result);
return result;
}
Run Code Online (Sandbox Code Playgroud)
但我正在加油(警告:'UIViewController'可能无法响应'-ssidValue:arrayOf:')并使其崩溃.
请告诉我这里我做错了什么.
提前致谢
alb*_*amg 17
您将该方法声明为类方法(请注意"+"),但您将其称为实例方法.
要解决此问题,请将其声明为实例方法(将"+"替换为" - ")或将其称为类方法:
[[self class] ssidValue:1 arrayOf:ssidArray];
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
15808 次 |
| 最近记录: |