Chris Knadler
Chris Knadler

Reputation: 2847

Resizing UITableView using ViewDeck

I am trying to mimic the sliding table view functionality found in apps like Facebook. I am currently using the Inferis/ViewDeck library. This works great as a slider but I can't figure out how to resize the table view to fit properly in the smaller space left by the slider without clipping.

Example:

Example

I have seen several other SO posts with similar questions but none that concisely answer how to resize a table view. Any examples or explanation would be great.

Upvotes: 0

Views: 1083

Answers (2)

user2360722
user2360722

Reputation: 111

It is not possible to resize a UITableViewController, but you can create a UITableView inside the UIViewController, and resize the UITableView.

Upvotes: 0

Chris Knadler
Chris Knadler

Reputation: 2847

For left oriented slider (i.e. slider that reveals a view to the left):

- (BOOL)viewDeckControllerWillOpenLeftView:(IIViewDeckController*)viewDeckController animated:(BOOL)animated 
{
    self.tableView.frame = (CGRect) { self.tableView.frame.origin.x,
                                      self.tableView.frame.origin.y, 
                                      320 - self.viewDeckController.leftLedge,
                                      self.tableView.frame.size.height };
    return YES;
}

For right oriented slider:

- (BOOL)viewDeckControllerWillOpenRightView:(IIViewDeckController*)viewDeckController animated:(BOOL)animated 
{
    self.tableView.frame = (CGRect) { self.viewDeckController.rightLedge,
                                      self.tableView.frame.origin.y, 
                                      320 - self.viewDeckController.rightLedge,
                                      self.tableView.frame.size.height };
    return YES;
}

Upvotes: 4

Related Questions