开发者

how to decrease the height of table of class UITableViewController?

I am using table view in a view controller which is UITableViewController. I am trying to set the height of table by

[self.tableView setFrame:CGRectMake(0, 0, 320, 300)];
[self.tableView setBackgroundView:bac开发者_StackOverflow社区kImageView];
    [self.tableView setSeparatorColor:[UIColor blackColor]];

but it is not working. It doesn't have XIB Is there any way to do that?


For what I know you can't do that (IF you push/showModal the tableviewcontroller), the view (in this case a tableview) of viewcontrollers is resized automatically to the screen size (- status bar, navigationbar and tabbar). You can however set contentOffset and contentInset.

In your case this should work (might need to change the values):

self.tableView.contentInset = UIEdgeInsetsMake(0 /*top*/, 0/*left*/, 160/*bottom*/, 0/*right*/);


Difficult to say without some more detail. For instance, are you creating your UITableView object in your LoadView?

self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, 320, 320)];

You also need to make sure you are adding your tableView to the view controller's view:

[self addSubView:tableView];

Hope this helps, but a bit more detail in your question would enable a more thorough answer. i.e., what does not work, etc.

Dave

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜