我有一个属性,我在viewDidLoad中初始化,在我的头文件中声明。在viewDidLoad中,我在这里声明:
- (void)viewDidLoad {
[super viewDidLoad];
viewControllerList = [NSMutableArray new];
vc = [self.storyboard instantiateViewControllerWithIdentifier:@"moreSpeedyCafeViewController"];
[self loadDefaults];
self.dataSource = self;
在loadDefaults方法中,我正在迭代数组并设置其属性。当我在调试器中单步执行时,即使设置后值也为零。字典中的值不是零,我已经检查过了。我不确定为什么会这样。
for (NSMutableDictionary *newDict in array) {
tempDict = newDict;
NSData *imageData = [[NSData alloc] initWithContentsOfURL:[NSURL URLWithString:[[tempDict objectForKey:@"ImageUrls"]objectAtIndex:0]]];
vc.dmsImageView.image = [UIImage imageWithData:imageData];
vc.dmsDescriptionLabel.text = [tempDict objectForKey:@"Title"];
vc.dmsLinkText.text = [tempDict objectForKey:@"LinkText"];
vc.index = [array indexOfObject:tempDict];
[viewControllerList addObject:vc];
}