Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Thread Tools Search this Thread Display Modes
Old Aug 18, 2010, 10:54 AM   #1
macrumors newbie
Join Date: Aug 2010
UITableView positioning & styling


my app uses a tab bar with 2 navigation based views in which I am adding a custom view (a title bar) between the nav bar and the table view .

- (void)viewDidLoad {
    [super viewDidLoad];
	// load title bar controller
	TitleBarViewController *tbar = [[TitleBarViewController alloc] init];
	[tbar setTitleImage:[UIImage imageNamed:@"v2-une.png"]];
	[self setTitleBar:tbar];
	[tbar release];
	// show title bar
	[self.navigationController.view addSubview:self.titleBar.view];

When the application is launched with a default selected nav view, I use (void)viewDidAppearBOOL)animated to set the table view to a lower Y value so that the title bar is visible.

Where Y = 20 : 20 is the height of my title bar.

self.tableView.frame = CGRectMake(0, 20, 320, 347);
The problem is that when I select a row and push a detail view and hide the bottom bar to display a toolbar, things are messed up.
my title bar's height increases and becomes > 20 which I can't explain why.

Now when I go back to the main table view, its Y is decreased by 20 and sticked to the nav bar. My title ben then appears above the first cell of the table view.

If hit the 2 tab and then go back to the 1st tab, everything is re arranged like expected.

here are some pics to illustrate all that :

can anyone help me figure out why is this happening please ?
may be I am putting my positioning code in the wrong event ?
hatembr is offline   0 Reply With Quote
Old Aug 18, 2010, 12:02 PM   #2
macrumors 68020
PhoneyDeveloper's Avatar
Join Date: Sep 2008
Are you using a UITableViewController?

I recommend that you not add your title bar to the navbar. Instead have a container view that holds the title bar and the table view. You need to use a UIViewController subclass instead of UITableViewController in this case. The container view will be the view controller's view property. You'll have more control in this way.
PhoneyDeveloper is offline   0 Reply With Quote
Old Aug 18, 2010, 12:11 PM   #3
Thread Starter
macrumors newbie
Join Date: Aug 2010
thank you for answering PhoneyDeveloper.

yes I use a UITableViewController. Everything is designed in IB.

can your suggestion be done in IB or do I have to do it programmatically ?
hatembr is offline   0 Reply With Quote

MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
Window Size/Position & Clamshell Mode palebluedot Mac OS X 10.7 Lion 3 Mar 19, 2012 08:52 PM
problem after adding a subview on a UITableView ashwinr87 iPhone/iPad Programming 1 Jul 19, 2011 01:13 PM
Change the uitableview footer height in landscape mode franium iPhone/iPad Programming 2 Jan 14, 2011 02:04 PM
how to hide empty rows in a UITableView and change the height of the Uitableview base suresh2mv iPhone/iPad Programming 1 Nov 18, 2010 07:13 AM
FS: Powerbook G3 & Style writer printer funbun Marketplace Archive 1 (Posts count) 1 Aug 9, 2004 08:05 PM

All times are GMT -5. The time now is 11:15 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013,, LLC