1

I'm showing a splitview within a tabbar app. In every split view, master is a UITableViewController (with Freeform size). My Custom tabBar is 1024 x 80 px (always landscape mode), and I'd like to reduce (80-49) px from master & detail that my custom tabbar is hiding from both.

I tried everything, IB, programmatically, in viewWillAppear, with initWithStyle, initWithNib, viewDidLoad, AutoResizing = NO, setbounds, setframe, contentSize... and nothing can make my UITableView to be reduced 31 px!

The UITableView has custom grouped cells, and a backgroundimage. Could be the image the problem?

Any ideas of how can I reduce the size of my UITableView? It has to be the outlet view of File's owner in that viewcontroller? I don't what else to think/do...

Many many thanks in advance, I need to finish this ASAP and that has become a real trouble.

Thanks guys!

agapitocandemor
  • 696
  • 11
  • 25

2 Answers2

2

I ran into this problem as well. I dont think it is possible with the UITableViewController. I ended up having to create my own subclass of UIViewController with a UITableView as a subview of the viewController's main view. This way you can modify the placement and height within your viewController. One thing to note, if you go this route, make sure to send the tableview the flashScrollIndicators method so that it simulates the behavior of the UITableViewController.

Good luck

timthetoolman
  • 4,613
  • 1
  • 22
  • 22
  • Can you please give me a clue of how to subclass a UITableView? New file and UIViewController, add a UITableView to IB, UITableView instance, both tableview delegates...? Thank you. I tried it before and was a little bit messy. – agapitocandemor Nov 07 '11 at 10:27
  • Ok, I subclassed the tableview. Now the problem is that I can't reduce the size of the view that contains the custom tableview as a subview. It's the master view of a splitview. How can I reduce now the size of my master view? Any ideas? Thanks a lot. – agapitocandemor Nov 07 '11 at 13:04
  • sorry if you misunderstood me. You don't need to subclass a UITableView. You need to subclass a UIViewController and add a UITableView to the view of the UIViewController. This way, the tableView is just another subview on the screen and can be resized according to how you want it. – timthetoolman Nov 07 '11 at 15:06
  • Yes yes, that's what I did, but I said subclass the TableView. If I add the tableview as a subview, any problem. But my problem persists, as now the View is what I can't reduce. Now I have a tableview with the desired size, in a View that I can't resize. Any idea? Thanks a lot for your new comment. – agapitocandemor Nov 07 '11 at 20:31
  • your main view in a viewController will always conform to the size it has to work with. i.e. the window or parentViewController. – timthetoolman Nov 07 '11 at 21:36
0

I think you should try to set size in viewDidAppear. like i did

  • (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated];

    [self.tableView setFrame:CGRectMake(self.tableView.frame.origin.x, self.tableView.frame.origin.y, self.tableView.frame.size.width, self.tableView.frame.size.height - 50)]; }

Anand Mishra
  • 1,093
  • 12
  • 15