Reputation: 2670
I have a tableview that I need to push down and resize smaller. I cannot use the content inset for this as its not the content I need to push down. I need to actually move the entire tableview down 44px.
What I have tried:
CGRect tableViewFrame = self.tableView.frame;
tableViewFrame.origin.y = 44;
self.tableView.frame = tableViewFrame;
Thank you in advance!
Upvotes: 1
Views: 2899
Reputation: 8402
you can not move UITableviewController down, instead of this you can do like this
it works fine.. :)
Upvotes: 0
Reputation: 115
Convert your UITableviewController
to a UIViewController
and then add the tableview
as subview
in your nib. Also don't just change the y coordinate of tableview
. instead define a new frame for your tableview
e.g. self.tableView.frame = CGRectMake(x,y,width,height)
Upvotes: 1
Reputation: 3158
You need to change your UITableViewController
to a regular UIViewController
and then add the table as a subview. Then, just manually implement the UITableViewDelegate
and UITableViewDataSource
protocols in that view controller. After doing this, you can move the table view with your above code like any other subview.
Have a look at this answer for an example.
Upvotes: 7