Re: Adding UINavBar to split view detail in storyboard?
Re: Adding UINavBar to split view detail in storyboard?
- Subject: Re: Adding UINavBar to split view detail in storyboard?
- From: Rick Mann <email@hidden>
- Date: Mon, 12 Nov 2012 23:03:04 -0800
I finally suceeded in doing what I needed to do, although it's not ideal.
It's possible to separate UITableViewController's view from its tableView. I subclassed UITableViewController, and in -viewDidLoad I:
- Remember the current self.tableView in an ivar
- Create a UIView matching the tableView's frame
- Install the tableView into my UIView in the appropriate position
- Create and install my other (sibling) views
- Set self.view to point to my newly-created view
Then, I implement a getter for tableView that returns my remembered tableView ivar.
This seems to work. I'll reply if I find a problem. It also tells me there's no reason UITableView and IB couldn't support this
directly.
--
Rick
On Nov 12, 2012, at 17:24 , Rick Mann <email@hidden> wrote:
>
> On Nov 12, 2012, at 7:30 , Fritz Anderson <email@hidden> wrote:
>
>> The whole point of a UITableViewController is to have a controller that autonomously instantiates a table view as its root view. Interface Builder isn't making an arbitrary choice; the controller, not IB, creates the view.
>
> Actually, I disagree. IB is still creating the view. It's clearly present in the storyboard, and if you remove it, you don't get the view.
>
>> If you want a UITableView to be a sibling of other views, instantiate a UIViewController subclass, make its .view a plain UIView (or as the problem demands), drop in the table view along with sibling views, and connect the table to an outlet in the controller. You won't get a template with the delegate and data source methods prefilled, but there's nothing magic about it. Just put UITableViewController.h into the Assistant editor and paste the declarations into your controller's implementation.
>
> Unfortunately, if you do this, you don't get any of the built-in support for creating static table view cells in IB (nor can you build dynamic cells).
>
> For that matter, you really aren't able to have multiple table views in a window and take advantage of directly editing them in IB.
>
>
> --
> Rick
>
>
>
>
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
--
Rick
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden