我制作了一个数组和一个字典。现在我想将字典的值放入数组中。我对目标 C 很陌生,所以请帮忙。“视图控制器.m”
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad
{
[super viewDidLoad];
marray = [[NSMutableArray alloc]initWithObjects:@"1",@"2",@"3",@"4", nil];
marray = [[NSMutableArray alloc]initWithObjects:@"6",@"7",@"8",@"9",@"10", nil];
[self displayarray];
[marray release];
mDictionary = [[NSMutableDictionary alloc]init];
[mDictionary setValue:@"sdfsdhfg" forKey:@"firstname"];
[mDictionary setValue:@"kvxv" forKey:@"lastname"];
[self displaydict];
[mDictionary release];
}
-(void)displaydict{
CFShow(mDictionary);
}
-(void)displayarray{
for (int i = 0; i<[marray count]; i++) {
NSLog(@"the array data present at %d index is %@",i,[marray objectAtIndex:i]);
}
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
}
@end