for(NSString *s in mainarr)
{
NSString newseparator = @"=";
NSArray *subarray = [s componentsSeparatedByString : newseparator];
//Copying the elements of array into key and object string variables
NSString *key = [subarray objectAtIndex:0];
NSLog(@"%@",key);
NSString *class_name= [subarray objectAtIndex:1];
NSLog(@"%@",class_name);
//Putting the key and objects values into hashtable
NSDictionary *dict= [NSDictionary dictinaryWithObject:@"class_name" forKey:@"key"];
}
你好.. 在上面的代码中,我已经在 for 循环中解析数组的元素,然后必须将子字符串 key 和 class_name 放入哈希表中。如何将这些字符串变量的值放入哈希表中。在上面的代码中,我猜变量 class_name 和 key 被放入哈希表而不是值。我想这是一个错误的方法。可以做些什么来实现解决方案?