-1
我正在写这个代码来创建从循环按钮,并将它们添加到UIScrollView但它不工作,请别人帮忙。 代码从循环添加按钮到UIScrollView
scroll = [[UIScrollView alloc]init];
[self createurdulistfordisplay];
for(int i = 1;i<[urdulist count];i++)
{
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
[button setBackgroundImage:[UIImage imageNamed:@"2.png"] forState:UIControlStateNormal];
[button addTarget:self
action:@selector(playurduaudio:)
forControlEvents:UIControlEventTouchDown];
button.frame = CGRectMake(80.0, 210.0 + (30*i), 213.0, 46.0);
[scroll addSubview:button];
}
你在哪里添加滚动视图?你应该设置它的框架来显示它。提供更多细节。 – Rakesh 2013-02-13 07:40:07
添加滚动到self.view – 2013-02-13 07:42:13
thanx我忘了在框架中添加scrollview ... thansx Rakesh和Ravindra – 2013-02-13 07:45:57