Saturday, 15 September 2012

ios - Point to Point Animation -


I want to create an animation shown in the image above. I am using this code. They become infinite and my views will not appear as they were included in the loop. I'm new to iOS. Please help. What am i doing Any help would be appreciated. (I = 0; i & lt; 3; i ++) for

{if (i == 0) {first.backgroundColor = [UIColor blackColor]; Second.backgroundColor = [UIColor yellowColor]; Third. Background color = [UIColor yellowColor]; button. Background color = [UIColor yellowColor]; I = 1; } If (I == 1) {first.backgroundColor = [UIColor yellowColor]; Second.backgroundColor = [UIColor blackColor]; Third. Background color = [UIColor yellowColor]; button. Background color = [UIColor yellowColor]; I = 2; } If (i == 2) {first.backgroundColor = [UIColor yellowColor]; Second.backgroundColor = [UIColor yellowColor]; Third. Background color = [UIColor blackColor]; button. Background color = [UIColor yellowColor]; I = 3; } If (I == 3) {first.backgroundColor = [UIColor yellowColor]; Second.backgroundColor = [UIColor yellowColor]; Third. Background color = [UIColor yellowColor]; button. Background color = [UIColor blackColor]; I = 0; }}

The first one global variable that tracks From which the background of the button changes and an array that stores all the buttons.

  @interface className () {int index = 0; NSArray * button; }  

Now in the initial method, do this

  [first setbackgram collar: [UIColor yellowColor]]; [Second setback color: [UIColor yellowColor]]; [Third setback color: [UIColor yellowColor]]; [Button setback color: [UIColor yellowColor]]; Button = @ [first, second, third, button]; [Self-choice selector: @Selector (Change Corror) with Object: After zero: 19 F];  

Now in your changecolor method, do this

  - (zero) changeroll {UIButton * btn = [buttons objectAtIndex: Index]; [BTN setbackgram color: [UIColor blackColor]]; UIButton * prevBtn = [Button ObjectAutex: ((index-1 + 4)% 4]; [PrevBtn setBackgroundColor: [UIColor yellowColor]]; Index = ++ index% 4; [Self-choice selector: @Selector (Change Corror) with Object: After zero: 19 F]; }  

No comments:

Post a Comment