Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Design iPhone Objective-C , +
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:
 
- (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 11-Feb-13 23:03pm
larssy1367
Edited 11-Feb-13 23:08pm
v2

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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.)
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 299
1 Maciej Los 295
2 Sergey Alexandrovich Kryukov 205
3 Aajmot Sk 202
4 Sinisa Hajnal 166
0 OriginalGriff 7,760
1 Sergey Alexandrovich Kryukov 7,072
2 DamithSL 5,604
3 Manas Bhardwaj 4,986
4 Maciej Los 4,785


Advertise | Privacy | Mobile
Web04 | 2.8.1411023.1 | Last Updated 13 Feb 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100