-1
객체 C 스타일 나는사전 어떻게 사전 배열을 만들 수 있습니까?
class ViewController: UIViewController {
var datalist = [Dictionary]() //Compile Error -> "Missing argument for parameter #1 in call"
// I can't understand error. What does it mean?
override func viewDidLoad() {
super.viewDidLoad()
let dict1 = ["age":"32","name":"andy"]
let dict2 = ["age":"34","name":"smith"]
let dict3 = ["age":"27","name":"jonathan"]
datalist = [dict1,dict2,dict3] //Compile Error -> 'ViewController' does not have a member named 'datalist'
}
}
하지만이 오류를
내가하지 다음과 같이
그래서 빠른 스타일을 입력 스위프트에 동일한 코드를 만들고 싶어
@interface TestViewController:UIViewController{
NSArray *dataList;
}
@end
@implementation TestViewController
- (void)viewDidLoad
{
[super viewDidLoad];
NSDictionary *dict1 =[[NSDictionary alloc] initWithObjectsAndKeys:@"32",@"age",@"andy",@"name", nil];
NSDictionary *dict1 =[[NSDictionary alloc] initWithObjectsAndKeys:@"34",@"age",@"smith",@"name", nil];
NSDictionary *dict1 =[[NSDictionary alloc] initWithObjectsAndKeys:@"27",@"age",@"jonathan",@"name", nil];
dataList = [[NSArray alloc]initWithObjects:dict1,dict2,dict3,nil];
}
@end
왜 이슈 오류인지 알 수 있습니다
도와 주시겠습니까? 신속한에서
정말 고맙습니다. – user1272854