Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 09-20-2010, 03:00 PM   #1 (permalink)
dch
Registered Member
 
Join Date: Sep 2010
Posts: 2
dch is on a distinguished road
Default noob question about dynamic UI components

I'm picking up iPhone dev now after experience programming for Android and Blackberry.

With Android and Blackberry, when you add a component to the screen, it adds below the last component added. If I added 2 UILabels for example, I would never have an issue with one overlapping the other.

So my problem: On one screen, there may be 1 button or 4 buttons displayed vertically. Then below the buttons is a UILabel. Do I always have to manage positioning of these components? Or can I define a layout where as I add components, it automatically determines the y position based on the the previous component's position?

Thanks.
dch is offline   Reply With Quote
Old 09-20-2010, 03:04 PM   #2 (permalink)
dch
Registered Member
 
Join Date: Sep 2010
Posts: 2
dch is on a distinguished road
Default

For example, do I need to use CGRectMake? Or is there a layout manager I can use as an alternative and not pass the x/y coordinates?

Code:
	int x=0;
	while (anObject = [enumerator nextObject]) {
		UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
		button.tag = x+1;
		button.frame = CGRectMake(35, 10+40+5+45*x, 250, 40);
		[button setTitle:[anObject objectForKey:@"name"] forState:UIControlStateNormal];
		[button addTarget:self action:@selector(teamPick:) forControlEvents:UIControlEventTouchUpInside];
		[self.view addSubview:button];	
		x++;
	}
dch is offline   Reply With Quote
Old 09-20-2010, 03:58 PM   #3 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,990
BrianSlick has a spectacular aura about
Default

I believe what you are looking for is Interface Builder.
__________________
BriTer Ideas LLC - Professional iOS App Development. Available for hire.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
Definitive Guide To Properties | UITableView Series | Guide To Troubleshooting | Model Object Overview

Do you sit at a desk all day? Walk instead! Follow along with my treadmill desk adventures.
BrianSlick is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 316
13 members and 303 guests
2ndSegment, cayladv57, cgokey, djohnson, Domele, Hamad, linkmx, markuschow, mistergreen2011, pungs, Sloshmonster, v1n2e7t
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,655
Threads: 94,116
Posts: 402,889
Top Poster: BrianSlick (7,990)
Welcome to our newest member, pungs
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 11:02 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0