Here I used tag values to differentiate the uibuttons. I want to move the uibuttons to different positions around table (like zynga poker)without using tag values? X and Y positions has to differ. for example if i write x+=100; y+=12; every time x and y positions will be incremented by same value but in round table x and y positions wont be incremented by same values.
With the below code i can move the uibutton(or uiimageviews) to that positions using tag values but code will become more(means it'll occupy more memory).
I just wanna distribute 35 image cards.
Can anyone provide me some information regarding this?
Code:
for(int i=1 ;i<35;i++)
{
NSLog(@"inside for loop");
UIButton *btn_show=[UIButton buttonWithType:UIButtonTypeCustom];
btn_show.frame=CGRectMake(190+(i/2), 20, 71, 96);
btn_show.tag=i;
[btn_show setImage:[UIImage imageNamed:@"back.png"] forState:UIControlStateNormal];
[self.view addSubview:btn_show];
[self fun_Animations:btn_show];
}
-(void)fun_ViewAnimations
{
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationBeginsFromCurrentState:YES];
[UIView setAnimationDuration:0.2];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
}
-(void)fun_Animations:(UIButton *)button
{
[self fun_ViewAnimations];
if(button.tag==1)
{
[UIView setAnimationDelay:1.0];
button.frame=CGRectMake(290,10, 71, 96);
}
if(button.tag==2)
{
[UIView setAnimationDelay:1.2];
button.frame=CGRectMake(390,110, 71, 96);
}
.....
.....
[UIView commitAnimations];
}