UIButton overlapping problem in the UIView?
Posted
by sai
on Stack Overflow
See other posts from Stack Overflow
or by sai
Published on 2010-05-10T05:06:28Z
Indexed on
2010/05/10
5:08 UTC
Read the original article
Hit count: 605
iphone
im trying to create buttons as ahierarchy, first some buttons are displayed if i click any of the buttons it will navigate to the next viewcontroller displaying some more buttons. But here my problem is butons are overlapped with one another . means the buttons that should not be displayed are also comming along with those should be . my code is for(.................) { butt = [[UIButton alloc] initWithFrame:CGRectMake(...)];
image = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:[arr objectAtIndex:i]]]]; imageView = [[[UIImageView alloc] initWithImage:image] autorelease];
[butt setBackgroundImage:imageView.image forState:UIControlStateNormal]; [butt setTag:i];
[butt addTarget:self action:@selector(onClick:) forControlEvents:UIControlEventTouchUpInside]; [containerView addSubview:butt]; [butt release]; x+=butt.frame.size.width+2*hgap; i+=1; if (i==count+1) //[arr count] { printf("\nIN BREAK BUTTON\n"); break; }
}
y=y+(butt.frame.size.height+2*vgap);
}
Thankyou for the solution.
© Stack Overflow or respective owner