954,529 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

uiscrollview and buttons

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;
		}
ahsan1
Newbie Poster
19 posts since Feb 2009
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: