As it turns out I think I was just making things way too complicated with this approach. Instead, I turned my child view controllers into subclasses of UIView, added a UITableView to that, then added the UIView to the parent's scroll view as a subview. Here's an example in case anyone is interested:
My container:
class ProfileController < SharedController
def viewDidLoad
super
scroll_frame = self.view.bounds
@scroll = UIScrollView.alloc.initWithFrame(scroll_frame)
@scroll.bounces = true
@scroll.delegate = self
@scroll.alwaysBounceVertical = true
@scroll.contentSize = CGSizeMake(UIScreen.mainScreen.bounds.size.width, scroll_frame.size.height)
end
def tap_child(sender)
set_active_tab(sender)
controller = ChildPartial.alloc.initWithFrame(CGRectMake(0, self.tab_bar.frame.origin.y + self.tab_bar.frame.size.height, self.view.bounds.size.width, self.view.bounds.size.height))
controller.data = @data[:child]
controller.parent = self
controller.scroll_view = @scroll
controller.build_table
@scroll.addSubview(controller)
end
end
Child:
class ChildPartial < UIView
attr_accessor :data, :parent, :scroll_view
def initWithFrame(frame)
super
self
end
def data=(data)
@data = data
end
def parent=(parent)
@parent = parent
end
def scroll_view=(scroll_view)
@scroll_view = scroll_view
end
def build_table
@table = UITableView.alloc.initWithFrame(self.bounds, style: UITableViewStyleGrouped)
@table.autoresizingMask = UIViewAutoresizingFlexibleHeight
@table.userInteractionEnabled = false
@table.dataSource = self
@table.delegate = self
resize_scroll_view
self.addSubview(@table)
end
def resize_scroll_view
@scroll_view.contentSize = CGSizeMake(parent.view.bounds.size.width, parent.view.bounds.size.height + @table.bounds.size.height)
end
end