Click here to Skip to main content
15,886,729 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Dear coders,

I've started working on an iPhone app and i've been struggling with a few things.
The most struggled part is designing the interface.

Now I know there is a GUI designer, however, this is not the ideal tool to design items for within a scrollviewer, since you still have the limitation of the screendisplayed.

Now I've been doing this in code, looking like the following:

C#
- (void)addUserDetailViews
{
    lblUserDetailTitle = [[UILabel alloc] initWithFrame:CGRectMake(20, 30, 280, 21)];
    lblUserDetailTitle.text = @"User Details";
    lblUserDetailTitle.font = [UIFont boldSystemFontOfSize:18];
    lblUserDetailTitle.backgroundColor = [UIColor clearColor];
    [self.scrollView addSubview:lblUserDetailTitle];

    lblUserDetailBreakLine = [[UILabel alloc] initWithFrame:CGRectMake(20, 48, 280, 1)];
    lblUserDetailBreakLine.backgroundColor = [UIColor cyanColor];
    [self.scrollView addSubview:lblUserDetailBreakLine];

    lblUserDetailId = [[UILabel alloc] initWithFrame:CGRectMake(30, 60, 120, 21)];
    lblUserDetailId.text = @"ID";
    lblUserDetailId.font = [UIFont systemFontOfSize:15];
    lblUserDetailId.backgroundColor = [UIColor clearColor];
    [self.scrollView addSubview:lblUserDetailId];

    lblUserDetailDescription = [[UILabel alloc] initWithFrame:CGRectMake(30, 88, 120, 21)];
    lblUserDetailDescription.text = @"Name";
    lblUserDetailDescription.font = [UIFont systemFontOfSize:15];
    lblUserDetailDescription.backgroundColor = [UIColor clearColor];
    [self.scrollView addSubview:lblUserDetailDescription];
}


I can understand that this is not the best way to create an iPhone / iPad app..

Now i'm actually looking for a way to do this simply by the designer using the object toolkit.

The main reason i'm asking this is because i'd need to have about 50 rows.. and accomplishing that in this way, might screw things up for an iPad version or what ever.

Is there anyone who could tell me how to accomplish this?

Yours Sincerely,
larssy1
Posted
Updated 11-Feb-13 22:08pm
v2

1 solution

It looks like what you really want is to use a UITableView. It's the standard UI element to use in iOS when you have rows of data like you are describing.

Take a look at this link:
http://developer.apple.com/library/ios/#documentation/userexperience/conceptual/tableview_iphone/tableviewstyles/tableviewcharacteristics.html[^]

The UITableView handles the layout and formatting of all the rows / sections -- you just tell it what style you want, and provide some methods that it can call to get the actual data that goes in each row.

That doesn't necessarily answer your question about how to layout a long view in the designer, but it does solve the problem you are describing.

If you really need to layout a long view in the designer, I believe it is possible to temporarily change the size (height) of the view you are designing so you can see the whole length of the scroll view, and then change it back to the actual height before you save it. (At least that was possible in the previous version of XCode -- the last version I downloaded had a lot of things re-arranged and changed, and I haven't had the time to figure out where all the controls/options when to, much less figure out what doesn't work any more.)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900