ahsan1 0 Newbie Poster

Hello

I am new to iphone application development. I making an application in which there are foods which I have to show on the iphone screen. I have made uiscrollview and buttons on it with images of dishes on it throgh loop but I am facing a problem that all buttons are being shown on one line and I want three buttons on one line and user would scroll the screen to see all the dishes and there buttons. Can anyone help me for this. Thanks in advance. The code for loop I have written is:

for(DBImagesObject *obj in self.rows)
	{
		NSLog(@"testing");
		UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
		
		[button setFrame:CGRectMake(curXLoc,10,kBtnWidth_iPhone, kBtnHeight_iPhone)];
	button.contentMode = UIViewContentModeScaleAspectFill;
				
		

		
		UIImage *img = [UIImage imageWithData:obj.imgData];
		
		[button setBackgroundImage:img forState:UIControlStateNormal];
				
		[scrollView addSubview:button];
		curXLoc += kBtnWidth_iPhone;
		}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.