iphone - set UIButton's Image by array of Images randomly -


I need your help because I do not know how I can set the background image of my UIButtons with an array of images I am I have an array of 10 UIButtons and 10 images. I randomly want to set the images from the array. Please tell me how this could be possible.

This may require a little tweaking, I have not tested it, but the concept is fine should be there.

  NSArray * arr = [NSArray arrayWithObjects: @ "1.png", @ "2.png", ...., zero]; Int Index = ARC 4 RRM ()% 10; UIImage * img = [UIImage imageNamed: [arr objectswithoutx: index]];    

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -