UITableViewController inside a UIViewController

前端 未结 4 1361
借酒劲吻你
借酒劲吻你 2020-12-13 16:03

I\'m new to iOS and objective-C and I\'m having some trouble in understanding how controllers work.

In my code I have a UIViewController (with my custom controller a

4条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-13 16:35

    You'll want to use an embedded container view.

    1. Drag a "Container View" from Interface Builder sidebar into the view. This adds and links a default "contained" UIView/Controller as well.

    2. Delete the entire UIViewController and View that was automatically added and linked to the container view (as you'll want a Table View Controller instead).

    3. Drag a UITableViewController onto the Storyboard canvas.

    4. Control-Drag from the Container View to the Table View Controller. Select "Embed" to contain the UITableView within the container view.

    You're left with the parent view, now containing a UITableView via a Container View. The Controller for the Table View is on the storyboard canvas as well.

提交回复
热议问题