insanj
insanj

Reputation: 161

Cannot resize UITableView

I've been searching all week for a way to resize my UITableView. I'm trying to create a UIView that lists "buddies" from AIM. I'm not very far, mostly because I keep getting stuck trying to figure out UITableViews. My final major issue is how the UITableView shows up in my UIView.

My navigation bar displays perfectly at the top, but the UITableView always appears beneath it, fullscreen, as if the bar isn't there- and I can't change it. I've tried to implement a ton of different solutions, none of which have worked so far.

Three (of the many) suggestions that I've tried:

stackoverflow.com/questions/2906449/uitableview-less-than-full-screen-from-code

discussions.apple.com/thread/1761745?start=0&tstart=0

iphonedevsdk.com/forum/iphone-sdk-development/18180-resizing-uitableview-programatically.html

Here's some code I thought would work, but didn't, just like most of the stuff with frames that were suggested elsewhere:

- (void)viewDidAppear:(BOOL)animated{

[[self view] addSubview:_navigationBar];

UIView *tableViewer = [UIView new];
[tableViewer addSubview:_buddiesTable];
[tableViewer setFrame:CGRectMake(0,0,50,50)];

[[self view] addSubview:tableViewer];
[super viewDidAppear:animated];

}

I'm not sure what else to supply for help; if anyone needs more material to help solve my problem, feel free to ask.

A screenshot from the problem in action.

A screenshot from the StoryBoard of the table in question.

Upvotes: 1

Views: 1479

Answers (1)

topLayoutGuide
topLayoutGuide

Reputation: 1397

Set the size manually within the Storyboard File and let me know how it goes. I encountered this a while ago while I was designing an app for a client.

FYI, Storyboard makes iPhone Development theoretically easier, though sometimes explicit IB use is best. :)

EDIT: I spot a problem above; Why are you creating a UIView of frame "0,0,50,50"? It may help to:

UIView *theView = [[UIView alloc] initWithFrame:[[UIScreen mainScreen]applicationFrame];
[theView addSubview:buddiesTable];
//etc...

Upvotes: 1

Related Questions