-5

Today I have a question on how to put a table view in Xcode 5.1. I want a table view which doesn't take over the whole iPhone screen. I am sending an illustration of what I want to achieve!

Bart
  • 19,692
  • 7
  • 68
  • 77
  • 1
    I haven't worked on Xcode 5.1 but I think the idea is the same on all versions. This table has a style **Grouped** instead of **Plain** and you can re size the table after you drag it to fit the size you want. – antf Jun 15 '12 at 19:52

2 Answers2

0

You can size any table view to be whatever size you want. Just drag a table view controller into your view controller's content view and hook up the outlets, delegate, and data source. We have an app in the app store where the iPad version uses a table view that lives in the left lower 1/2 of the screen, with other UI elements above and to the right.

Getting a functioning table view that's narrower than the screen width in portrait mode on the iPhone might be a challenge though, since the screen is pretty narrow to begin with. I'm not sure there's enough room to fit all the standard table view features (thumbnail icon, label, secondary label, disclosure triangle, drag area, delete button, etc, etc.

Duncan C
  • 128,072
  • 22
  • 173
  • 272
0

You can pragmatically set table view frame like This:

UITableView *table = [[[UITableView alloc] initWithStyle:UITableViewStylePlain] autorelease];
table.dataSource = self;
table.delegate = self;
table.frame = CGRectMake(0, 10, 320, 100);
[self.view addSubview:table];
Emil
  • 7,220
  • 17
  • 76
  • 135
mshau
  • 503
  • 4
  • 19