This is my first question on this forum and I hope u don’t blame me. I’m trying to make an app and need some help with NSMutableArray.
I declared in .h file some UIIMageView objects like this:
IBOutlet UIImageView *image1;
IBOutlet UIImageView *image2;
NSMuttableArray *images;
In .m file i set up the Hidden:YES.
Also I inserted them in an NSMuttableArray like this:
images = [[NSMutableArray alloc] initWithCapacity:2];
[images addObject:image1];
[images addObject:image2];
- How can I set up now a random UIImageView from the Array to be
setHidden:NO? - How to remove that object from the Array after it’s set up as not hidden?
- After an action like
-(IBAction) btnclick {}to make it again Hidden and show next random image from this NSMuttableArray in case they r much more.
This is probably what you want to do:
(also I’ll make it an array of UIImages since that is the way you should present random images imo but then again you can do this with UIImageViews as well, which is again not recommended)
This is probably the best way to deal with your problem.
You might want to add a method that removes the random image from the image view afterwards but then again you might not.