我有一个自定义类,它有一个整数作为变量。
// addons.h
-(NSMutableArray *) goodDirections:(int)iNumber;
// addons.m
-(NSMutableArray *) goodDirections:(int)iNumber;
{
NSString *gOne = @"one"+iNumber;
NSString *gTwo = @"two"+iNumber;
NSString *gThree = @"three"+iNumber;
NSString *gFour = @"four"+iNumber;
NSMutableArray *goodValues = [NSMutableArray arrayWithObjects:gOne,gTwo,gThree,gFour,nil];
return goodValues;
}
// ViewController.m
addons *directions =[[addons alloc]init];
NSMutableArray *helloTest = [[NSMutableArray alloc]init];
helloTest = [directions goodDirections:3];
NSString *obj1 = [helloTest objectAtIndex:1];
NSLog(@"%@",obj1);
并且自定义类有一个变量号,当输入时返回一个包含 4 个字符串值的数组,如何从我的实现文件 viewController.m 中的数组中检索值