I want to have an image that moves each time I hit a button. It should move a set value of pixels each time.
I was hoping that image1 now would have a position property, but as far as I can see it doesnt’t.
UIImageView *image1=[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"indicator"]];
[self.view addSubview:image1];
...
Thank you
EDIT: UIImageView *image1=[[UIImageView alloc]...
As the other two answers state, you can set the initial position of a UIImageView using a frame (or CGRect). Note that the parameters for the CGRectMake are; x position, y position, x dimension, y dimension.
To move the image each time you press a button, you’ll need to update the frame each time the button is pressed. However, the x and y coordinates of a frame are read only, so you’ll need to create a new frame like so:
Note that this code moves the image 10 points to the right, (along the x axis).