I would like to plot an image at a random position every time the user clicks on a button in my application. (I have made this video to illustrate this if it is not clear.)
How to do this?
That I’ve tried is the following.
int num,x,y;
-(IBAction)button{
num++;
x = arc4random%320;
y = arc4random%480;
UIImageView *flower_xxx;
(I want to “xxx” to like this “flower_%03d,num”)
flower_xxx.center = CGPoint(x,y);
}
an example that could use is as follows:
considers that this is what you put in the event of the button and it randomly places the image within the main view.
also considers that this is an example from which to take inspiration and do something better ^_^