conditional animation statement?

Discussion in 'iOS Programming' started by BollywooD, Dec 19, 2008.

  1. macrumors 6502

    Joined:
    Apr 27, 2005
    Location:
    Surfers Paradise
    #1
    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
     
  2. macrumors newbie

    Joined:
    Dec 20, 2008
    #2
    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
     

Share This Page