Hello,
I am pretty new to programming on iphone and have gotten stuck with something. I am trying to select a random picture from my array. Also, I only know how to make my array show as an animation and i was wondering how to make it so it just shows the image in the image view instead of animating it. I plan on having 300-500 images total. Thanks for any help! My code is attached.
Hello,
I am pretty new to programming on iphone and have gotten stuck with something. I am trying to select a random picture from my array. Also, I only know how to make my array show as an animation and i was wondering how to make it so it just shows the image in the image view instead of animating it. I plan on having 300-500 images total. Thanks for any help! My code is attached.
I did not look at your code, but It sounds like you're using a UIImageView and setting the animationImages property. If you set myView.animationImages = nil then you can set myView.image = anImage. That will display the single image "anImage".
300 images is a lot, probably too many to load into memory at the same time. Instead, you should probably keep an NSArray of image *filenames* , and when you pick your random number, take that filename and load the image.
I did not look at your code, but It sounds like you're using a UIImageView and setting the animationImages property. If you set myView.animationImages = nil then you can set myView.image = anImage. That will display the single image "anImage".
300 images is a lot, probably too many to load into memory at the same time. Instead, you should probably keep an NSArray of image *filenames* , and when you pick your random number, take that filename and load the image.
could you give me an example of what an NSArray of image *filenames* would look like? And would I use the arc4random() function with that?
Something like that. It should add all the objects to "imageArray".
Set a break point and make sure its working.
Hey thanks for the all the info you gave us, it helped a lot. we did it a little bit differently than how you said but the info you gave us contributed to our success. We have a new problem though: the loaded image loads to the top left of the screen. I have another post with the specific info so if you know anything that could be going wrong, please tell us. Thanks again! The link is:
I been trying to accomplish something along the same lines but I only have about 10 images. I also want to have a options menu where I can turn groups of images off. So if the flick the switch of mountians off then no mountains will be generated. Since I only have about 10 image should I go with some more like this: