本文介绍了iPhone-更新NSMutablearray的第n个对象的属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
可能是我在这里的第一篇文章.我有一个NSMutableArray * iconsMutableArray;并在NSMutableArray中添加了一些UIImageView.
Probably its my first post here.I have anNSMutableArray *iconsMutableArray;And have added some UIImageView in the NSMutableArray.
for (int i = 2; i <= 9; i++) {
UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:[NSString stringWithFormat:@"Guide-Icon-%d.png", i]]];
[iconsMutableArray addObject:imageView];
[imageView release];
}
现在我想在UIImageView中更改第N个对象的UIImage源.我怎样才能?我尝试了几种方法,例如,
Now i want to change the UIImage source of Nth object in the UIImageView. How can I?I have tried several ways e.g,
[[iconsMutableArray objectAtIndex:activeItem] image] = [UIImage imageNamed:@"Guide-Icon-7_Active.png"];
有人可以帮助我吗?
推荐答案
[[iconsMutableArray objectAtIndex:activeItem] setImage:[UIImage imageNamed:@"Guide-Icon-7_Active.png"]];
这篇关于iPhone-更新NSMutablearray的第n个对象的属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!