I’m trying to simply move an image view from right to left starting at position 0, 0 and ending at -280, 0 but I can’t seem to get the code working…
in the viewController .h file
IBOutlet UIImageView *testbg;
in the .m
-
(void)viewDidLoad {
//move background image
int i;
int newX;
NSLog(@“%d”, testbg.center);for(i=0; i < 280; i++) {
newX = i*-1;
[UIView beginAnimations:@“test” context:NULL]; //context is not needed in this example. Also, it’s good to name your animation.
[UIView setAnimationDelegate:self];
[UIView setAnimationDuration:0.1];
[UIView setAnimationDidStopSelector:@selector(theAnimationDidStop:finished:context:)];
testbg.center = CGPointMake(newX, 0);
[UIView commitAnimations];
}[super viewDidLoad];
}
doesn’t break but doesn’t work either.