Reputation: 3767
I am trying to segue from a UITableViewController embedded in a Container, to another UIViewController. The issue is, Storyboard keeps resizing the new UIViewController to fit into the Container... I am pretty new to overriding the PrepareForSegue and others, and I have a feeling that is what I need to do...
This is what I tried first, the segue to the SecondPracticeViewController is coming from the first cell on the UITableViewController static cell. Notice the SecondViewController gets resized to fit into the container.
I then set it up so the segue came from the PracticeTableViewContainer and titled the segue "SegueFromContainer"
This is a screenshot of what I think I need to do. What do I need to do to get this to work? I don't know what exactly to override. Thank you very much!
Upvotes: 3
Views: 2420
Reputation: 21
If you decide to do it the latter way that you mentioned in your question, you can override tableView:didSelectRowAtIndexPath in your tableViewController and call
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[self.parentViewController performSegueWithIdentifier:@"Segue" sender:self];
}
Upvotes: 2
Reputation: 104082
I just tried something out, and found that if you do a push from the TableViewController, the SecondPracticeViewController shows up full scale, even though it looks small in IB. So, to fix that, you can change the size of that controller from "Inferred" to "Freeform" in the attributes inspector -- this will allow you to adjust the size of its view to be what ever you want, so you can layout the subviews visually.
Upvotes: 4