PDA

View Full Version : conditional animation statement?




BollywooD
Dec 20, 2008, 01:20 AM
I am trying to create a set of if statements, depending on the initial position of 3 objects, will decide which position they all move to. (does that make sense?)
Here is my code i am trying to implement it into:

- (void)move {
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:1.0];
imageView1.center = Center1;
imageView2.center = Center2;
imageView3.center = Center3;
[UIView commitAnimations];
}

ive tried using:

if (imageView1.center == Center2) {
imageView1.center = Center1;
imageView2.center = Center3;
imageView3.center = Center2
}
else if (imageView1.center = Center3) {
imageView1.center = Center1
imageView2.center = Center2;
imageView3.center = Center3;
}


but i get the error
"error: invalid operands to binary =="


its probably really simple, but im stumped.
can any one help.

thanks in advance



kierster
Dec 20, 2008, 01:17 PM
Check your else if there, is that the error you're talking about? it only has one = in the brackets.
If your error is at the line with the if statement then check to make sure that Center2 is the same dataType as imageView.center I guess