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
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