Managing content size of UIViewController + UITableView in popover

There seems no reason to manually set and observe things again. Provlded that you wrap it in a navigation controller, this works:

+ (NSSet *) keyPathsForValuesAffectingContentSizeForViewInPopover {

    return [NSSet setWithObjects:

        @"tableView.contentInset",
        @"tableView.contentSize",

    nil];

}

- (CGSize) contentSizeForViewInPopover {

    return (CGSize){

        320,
        self.tableView.contentInset.top + self.tableView.contentSize.height + self.tableView.contentInset.bottom

    };

}

Related: