ios - how to add UIButton to UIView with animation effect -


i have uiview in that, going add 15 uibuttons. if have written code

for(int =0; i<15;i++) {     [self.view addsubview:[self.buttonsarray objectatindex;i]]; } 

but want subview uibuttons 1 after other. animation effect.how achieve it.

try this:

in .h file

nstimer *timer; int buttonno;  @property (nonatomic,retain) nstimer *timer; 

in .m file

@synthesize timer;  -(void) viewdidload {     [super viewdidload];     //start timer write loop     buttonno = 0;     timer = [nstimer scheduledtimerwithtimeinterval:3.0 target:self selector:@selector(addbuttons) userinfo:nil repeats:yes]; }    -(void) addbuttons {     [self.view addsubview:[self.buttonsarray objectatindex;buttonno]];     buttonno++;     if (buttonno == 15) {         [timer invalidate];         timer = nil;     } } 

Comments