In a storyboard, how do I make a custom cell for use with multiple controllers? - objective-c

I'm trying to use storyboards in an app I'm working on. In the app there are Lists and Users and each contains a collection of the other (members of a list, lists owned by a user). So, accordingly, I have ListCell and UserCell classes. The goal is to have those be re-usable throughout the app (ie, in any of my tableview controllers).
That's where I'm running into a problem.
How do I create a custom tableview cell in the storyboard that can be re-used in any view controller?
Here are the specific things I've tried so far.
In Controller #1, added a prototype cell, set the class to my UITableViewCell subclass, set the reuse id, added the labels and wired them to the class's outlets. In Controller #2, added an empty prototype cell, set it to the same class and reuse id as before. When it runs, the labels never appear when the cells are shown in Controller #2. Works fine in Controller #1.
Designed each cell type in a different NIB and wired up to the appropriate cell class. In storyboard, added an empty prototype cell and set its class and reuse id to refer to my cell class. In controllers' viewDidLoad methods, registered those NIB files for the reuse id. When shown, cells in both controllers were empty like the prototype.
Kept prototypes in both controllers empty and set class and reuse id to my cell class. Constructed the cells' UI entirely in code. Cells work perfectly in all controllers.
In the second case I suspect that the prototype is always overriding the NIB and if I killed the prototype cells, registering my NIB for the reuse id would work. But then I wouldn't be able to setup segues from the cells to other frames, which is really the whole point of using storyboards.
At the end of the day, I want two things: wire up tableview based flows in the storyboard and define cell layouts visually rather than in code. I can't see how to get both of those so far.

As I understand it, you want to:
Design a cell in IB which can be used in multiple storyboard scenes.
Configure unique storyboard segues from that cell, depending on the scene the cell is in.
Unfortunately, there is currently no way to do this. To understand why your previous attempts didn't work, you need to understand more about how storyboards and prototype table view cells work. (If you don't care about why these other attempts didn't work, feel free to leave now. I've got no magical workarounds for you, other than suggesting that you file a bug.)
A storyboard is, in essence, not much more than a collection of .xib files. When you load up a table view controller that has some prototype cells out of a storyboard, here's what happens:
Each prototype cell is actually its own embedded mini-nib. So when the table view controller is loading up, it runs through each of the prototype cell's nibs and calls -[UITableView registerNib:forCellReuseIdentifier:].
The table view asks the controller for the cells.
You probably call -[UITableView dequeueReusableCellWithIdentifier:]
When you request a cell with a given reuse identifier, it checks whether it has a nib registered. If it does, it instantiates an instance of that cell. This is composed of the following steps:
Look at the class of the cell, as defined in the cell's nib. Call [[CellClass alloc] initWithCoder:].
The -initWithCoder: method goes through and adds subviews and sets properties that were defined in the nib. (IBOutlets probably get hooked up here as well, though I haven't tested that; it may happen in -awakeFromNib)
You configure your cell however you want.
The important thing to note here is there is a distinction between the class of the cell and the visual appearance of the cell. You could create two separate prototype cells of the same class, but with their subviews laid out completely differently. In fact, if you use the default UITableViewCell styles, this is exactly what's happening. The "Default" style and the "Subtitle" style, for example, are both represented by the same UITableViewCell class.
This is important: The class of the cell does not have a one-to-one correlation with a particular view hierarchy. The view hierarchy is determined entirely by what's in the prototype cell that was registered with this particular controller.
Note, as well, that the cell's reuse identifier was not registered in some global cell dispensary. The reuse identifier is only used within the context of a single UITableView instance.
Given this information, let's look at what happened in your above attempts.
In Controller #1, added a prototype cell, set the class to my
UITableViewCell subclass, set the reuse id, added the labels and wired
them to the class's outlets. In Controller #2, added an empty
prototype cell, set it to the same class and reuse id as before. When
it runs, the labels never appear when the cells are shown in
Controller #2. Works fine in Controller #1.
This is expected. While both cells had the same class, the view hierarchy that was passed to the cell in Controller #2 was entirely devoid of subviews. So you got an empty cell, which is exactly what you put in the prototype.
Designed each cell type in a different NIB and wired up to the
appropriate cell class. In storyboard, added an empty prototype cell
and set its class and reuse id to refer to my cell class. In
controllers' viewDidLoad methods, registered those NIB files for the
reuse id. When shown, cells in both controllers were empty like the
prototype.
Again, this is expected. The reuse identifier is not shared between storyboard scenes or nibs, so the fact that all of these distinct cells had the same reuse identifier was meaningless. The cell you get back from the tableview will have an appearance that matches the prototype cell in that scene of the storyboard.
This solution was close, though. As you noted, you could just programmatically call -[UITableView registerNib:forCellReuseIdentifier:], passing the UINib containing the cell, and you'd get back that same cell. (This isn't because the prototype was "overriding" the nib; you simply hadn't registered the nib with the tableview, so it was still looking at the nib embedded in the storyboard.) Unfortunately, there's a flaw with this approach — there's no way to hook up storyboard segues to a cell in a standalone nib.
Kept prototypes in both controllers empty and set class and reuse id
to my cell class. Constructed the cells' UI entirely in code. Cells
work perfectly in all controllers.
Naturally. Hopefully, this is unsurprising.
So, that's why it didn't work. You can design your cells in standalone nibs and use them in multiple storyboard scenes; you just can't currently hook up storyboard segues to those cells. Hopefully, though, you've learned something in the process of reading this.

In spite of the great answer by BJ Homer I feel like I have a solution. As far as my testing goes, it works.
Concept: Create a custom class for the xib cell. There you can wait for a touch event and perform the segue programmatically. Now all we need is a reference to the controller performing the Segue. My solution is to set it in tableView:cellForRowAtIndexPath:.
Example
I have a DetailedTaskCell.xib containing a table cell which I'd like to use in multiple table views:
There is a custom class TaskGuessTableCell for that cell:
This is where the magic happens.
// TaskGuessTableCell.h
#import <Foundation/Foundation.h>
#interface TaskGuessTableCell : UITableViewCell
#property (nonatomic, weak) UIViewController *controller;
#end
// TashGuessTableCell.m
#import "TaskGuessTableCell.h"
#implementation TaskGuessTableCell
#synthesize controller;
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
NSIndexPath *path = [controller.tableView indexPathForCell:self];
[controller.tableView selectRowAtIndexPath:path animated:NO scrollPosition:UITableViewScrollPositionNone];
[controller performSegueWithIdentifier:#"FinishedTask" sender:controller];
[super touchesEnded:touches withEvent:event];
}
#end
I have multiple Segues but they all have the same name: "FinishedTask". If you need to be flexible here, I suggest to add another property.
The ViewController looks like this:
// LogbookViewController.m
#import "LogbookViewController.h"
#import "TaskGuessTableCell.h"
#implementation LogbookViewController
- (void)viewDidLoad
{
[super viewDidLoad]
// register custom nib
[self.tableView registerNib:[UINib nibWithNibName:#"DetailedTaskCell" bundle:[NSBundle mainBundle]] forCellReuseIdentifier:#"DetailedTaskCell"];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
TaskGuessTableCell *cell;
cell = [tableView dequeueReusableCellWithIdentifier:#"DetailedTaskCell"];
cell.controller = self; // <-- the line that matters
// if you added the seque property to the cell class, set that one here
// cell.segue = #"TheSegueYouNeedToTrigger";
cell.taskTitle.text = [entry title];
// set other outlet values etc. ...
return cell;
}
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if([[segue identifier] isEqualToString:#"FinishedTask"])
{
// do what you have to do, as usual
}
}
#end
There might be more elegant ways to achieve the same but - it works! :)

I was looking for this and I found this answer by Richard Venable. It works for me.
iOS 5 includes a new method on UITableView: registerNib:forCellReuseIdentifier:
To use it, put a UITableViewCell in a nib. It has to be the only root
object in the nib.
You can register the nib after loading your tableView, then when you
call dequeueReusableCellWithIdentifier: with the cell identifier, it
will pull it from the nib, just like if you had used a Storyboard
prototype cell.

BJ Homer has given an excellent explanation of what is going on.
From a practical standpoint I'd add that, given you can't have cells as xibs AND connect segues, the best one to choose is having the cell as a xib - transitions are far easier to maintain than cell layouts and properties across multiple places, and your segues are likely to be different from your different controllers anyway. You can define the segue directly from your table view controller to the next controller, and perform it in code. .
A further note is that having your cell as a separate xib file prevents you being able to connect any actions etc. directly to the table view controller (I haven't worked this out, anyway - you can't define file's owner as anything meaningful). I am working around this by defining a protocol that the cell's table view controller is expected to conform to and adding the controller as a weak property, similar to a delegate, in cellForRowAtIndexPath.

Swift 3
BJ Homer gave an excellent explanation, It helps me understand the concept. To make a custom cell reusable in storyboard, which can be used in any TableViewController we have to mix the Storyboard and xib approach. Suppose we have a cell named as CustomCell which is to be used in the TableViewControllerOne and TableViewControllerTwo. I am making it in steps.
1. File > New > Click File > Select Cocoa Touch Class > click Next > Give Name Of your class(for example CustomCell) > select Subclass as UITableVieCell > Tick the also create XIB file checkbox and press Next.
2. Customize the cell as you want and set the identifier in attribute inspector for cell, here we ll set as CellIdentifier. This identifier will be used in your ViewController to identify and reuse the Cell.
3. Now we just have to register this cell in our ViewController viewDidLoad. No need of any initialization method.
4. Now we can use this custom cell in any tableView.
In TableViewControllerOne
let reuseIdentifier = "CellIdentifier"
override func viewDidLoad() {
super.viewDidLoad()
tableView.register(UINib(nibName: "CustomCell", bundle: nil), forCellReuseIdentifier: reuseIdentifier)
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier:reuseIdentifier, for: indexPath) as! CustomCell
return cell!
}

I found a way to load the cell for the same VC, not tested for the segues. This could be a workaround for creating the cell in a separate nib
Let's say that you have one VC and 2 tables and you want to design a cell in storyboard and use it in both tables.
(ex: a table and a search field with a UISearchController with a table for results and you want to use the same Cell in both)
When the controller asks for the cell do this:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString * identifier = #"CELL_ID";
ContactsCell *cell = [self.YOURTABLEVIEW dequeueReusableCellWithIdentifier:identifier];
// Ignore the "tableView" argument
}
And here you have your cell from the storyboard

If I understand your question correctly, this is fairly easy. Create a UIViewController in your storyboard that will hold your prototype cells and create a static shared instance that loads itself from the storyboard. To handle view controller segues, use the manual segue outlet and trigger on table view delegate didSelectRow (the manual segue outlet is the middle icon at the top of the view controller in the storyboard, in between 'First Responder' and 'Exit').
XCode 12.5, iOS 13.6
// A cell with a single UILabel
class UILabelCell: UITableViewCell {
#IBOutlet weak var label: UILabel!
}
// A cell with a signle UISwitch
class UISwitchCell: UITableViewCell {
#IBOutlet weak var uiSwitch: UISwitch!
}
// The TableViewController to hold the prototype cells.
class CellPrototypeTableViewController: UITableViewController {
// Loads the view controller from the storyboard
static let shared: CellPrototypeTableViewController = {
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let viewController = storyboard.instantiateViewController(withIdentifier: "cellProtoypeVC") as! CellPrototypeTableViewController
viewController.loadViewIfNeeded() // Make sure to force view controller to load the view!
return viewController
}()
// Helper methods to deque the cells
func dequeUILabeCell() -> UILabelCell {
let cell = self.tableView.dequeueReusableCell(withIdentifier: "uiLabelCell") as! UILabelCell
return cell
}
func dequeUISwitchCell() -> UISwitchCell {
let cell = self.tableView.dequeueReusableCell(withIdentifier: "uiSwitchCell") as! UISwitchCell
return cell
}
}
Use:
class MyTableViewController: UITableViewController {
override func numberOfSections(in tableView: UITableView) -> Int {
return 1
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 2
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
// Dequeue the cells from the shared instance
switch indexPath.row {
case 0:
let uiLabelCell = CellPrototypeTableViewController.shared.dequeUILabeCell()
uiLabelCell.label.text = "Hello World"
return uiLabelCell
case 1:
let uiSwitchCell = CellPrototypeTableViewController.shared.dequeUISwitchCell()
uiSwitchCell.uiSwitch.isOn = false
return uiSwitchCell
default:
fatalError("IndexPath out of bounds")
}
}
// Handling Segues
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
switch indexPath.row {
case 0: self.performSegue(withIdentifier: "first", sender: nil)
case 1: self.performSegue(withIdentifier: "second", sender: nil)
default:
fatalError("IndexPath out of bounds")
}
}
}

Related

Subclass of UICollectionViewCell Not Displaying

I have a UICollectionView that is displayed by clicking a table cell within a navigation controller. So the UICollectionView is the second screen in the navigation controller's stack.
Cells showed up fine in the collection view when I registered a nib and created the cell via the UICollectionViewCell class. But once I try to create a subclass for the cell, the collection view just shows up as a black screen. My project can be found here.
Link to Project in Dropbox
To subclass the UICollectionViewCell, I did the following:
Created the .h and .m files for the subclass of UICollectionViewCell. Referenced this custom class on the nib's attribute inspector.
Registered the custom class with the cell's reuse identifier, within viewDidLoad of the view controller that displays the collection view.
[self.collectionView registerClass:[CustomCollectionViewCell class] forCellWithReuseIdentifier:#"cvCell"];
Created an instance of the custom cell in "collectionView: cellForItemAtIndexPath:"
CustomCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:#"cvCell" forIndexPath:indexPath];
From what I've read, that should do it! But the collection view is showing up blank, can anyone help??
I checked your code. You have done perfectly. Collection view with cells is showing correctly, but you cannot see that since you are not setting any of the property of the cell. Just check by setting background color of the cell in cellForItem
cell.backgroundColor = [UIColor redColor];
If you are done everything in nib then you need to register nib instead of class. use registerNib instead of registerClass. If you are registering class you have to do everything programmatically.

How to get a reference to the view controller of a superview?

Is there a way to get a reference to the view controller of my superview?
There were several instances that I needed this on the past couple of months, but didn't know how to do it. I mean, if I have a custom button on a custom cell, and I wish to get a reference of the table view controller that controls the cell I`m currently in, is there a code snippet for that? Or is it something that I should just solve it by using better design patterns?
Thanks!
Your button should preferably not know about its superviews view controller.
However, if your button really needs to message objects that it shouldn't know the details about, you can use delegation to send the messages you want to the buttons delegate.
Create a MyButtonDelegate protocol and define the methods that everyone that conforms to that protocol need to implement (the callback). You can have optional methods as well.
Then add a property on the button #property (weak) id<MyButtonDelegate> so that any class of any kind can be set as the delegate as long as it conforms to your protocol.
Now the view controller can implement the MyButtonDelegate protocol and set itself as the delegate. The parts of the code that require knowledge about the view controller should be implemented in the delegate method (or methods).
The view can now send the protocol messages to its delegate (without knowing who or what it is) and the delegate can to the appropriate thing for that button. This way the same button could be reused because it doesn't depend on where it is used.
When I asked this question I was thinking of, in a situation where I have custom cells with buttons on them, how can the TableViewController know which cell's button was tapped.
More recently, reading the book "iOS Recipes", I got the solution:
-(IBAction)cellButtonTapped:(id)sender
{
NSLog(#"%s", __FUNCTION__);
UIButton *button = sender;
//Convert the tapped point to the tableView coordinate system
CGPoint correctedPoint = [button convertPoint:button.bounds.origin toView:self.tableView];
//Get the cell at that point
NSIndexPath *indexPath = [self.tableView indexPathForRowAtPoint:correctedPoint];
NSLog(#"Button tapped in row %d", indexPath.row);
}
Another solution, a bit more fragile (though simpler) would be:
- (IBAction)cellButtonTapped:(id)sender
{
// Go get the enclosing cell manually
UITableViewCell *parentCell = [[sender superview] superview];
NSIndexPath *pathForButton = [self.tableView indexPathForCell:parentCell];
}
And the most reusable one would be to add this method to a category of UITableView
- (NSIndexPath *)prp_indexPathForRowContainingView:(UIView *)view
{
CGPoint correctedPoint = [view convertPoint:view.bounds.origin toView:self];
return [self indexPathForRowAtPoint:correctedPoint];
}
And then, on your UITableViewController class, just use this:
- (IBAction)cellButtonTapped:(id)sender
{
NSIndexPath *pathForButton = [self.tableView indexPathForRowContainingView:sender];
}
If you know which class is the superview of your view controller, you can just iterate through the subviews array and typecheck for your superclass.
eg.
UIView *view;
for(tempView in self.subviews) {
if([tempView isKindOfClass:[SuperViewController class] ])
{
// you got the reference, do waht you want
}
}

prepareForSegue is not called after performSegue:withIdentifier: with popover style

I have a universal app, where I am sharing the same controller for a IPad and IPhone storyboard.
I have put a UILongPressGestureRecognizer on a UITableView, that when a cell is pressed on iPhone it calls an action that perform a segue:
-(IBAction)showDetail:(id)sender {
UILongPressGestureRecognizer *gesture = (UILongPressGestureRecognizer*)sender;
if (gesture.state == UIGestureRecognizerStateBegan) {
CGPoint p = [gesture locationInView:self.theTableView];
NSIndexPath *indexPath = [self.theTableView indexPathForRowAtPoint:p];
if (indexPath != nil) {
[self performSegueWithIdentifier:SEGUE_DETAIL sender:indexPath];
}
}
}
the segue is a detail view performed as a 'push'. The first thing you should notice is that the sender is an NSIndexPath, is the only way I found for passing the selected cell. Maybe there's a better solution.
Everything works fine, in a sense that the segue is performed, and before the prepareForSegue is called too.
However it happens that on iPad, I have changed the segue identifier to Popover.
Now things are working in part, the segue is performed, but prepareForSegue is not called and therefore the destination view controller is not set up as it should be.
What am I doing wrong ?
What I have discovered so far, is that with any segue identifier that is not popover these are the invocations made by iOS:
prepareForSegue (on source controller)
viewDidLoad (on destination controller)
while in popover segue the invocation order is:
viewDidLoad (on destination controller)
prepareForSegue (on source controller)
just because I put all my logic in viewDidLoad, the controller was not properly initialized, and a crash happened. So this is not exactly true that prepareForSegue is not called, the truth is that I was getting an exception, and I wrongly mistaken as prepareForSegue not getting called.
I couldn't put everything in viewWillAppear because a call to CoreData had to be made and I didn't want to check if entities were ok each time the view display.
How did I solve this ? I created another method in destination controller
-(void)prepareViewController {
// initialization logic...
}
and changing the prepareForSegue method in source controller itself:
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
MyViewController *mvc = (MyViewController*)[segue destinationViewController];
// passing variable
// with segue style other than popover this called first than viewDidLoad
mvc.myProp1=#"prop1";
mvc.myProp2=#"prop2";
// viewWillAppear is not yet called
// so by sending message to controller
// the view is initialized
[mvc prepareViewController];
}
don't know if this is expected behavior with popover, anyway now things are working.
I've noticed that the boiler plate code for Xcode's Master-Detail template (iPhone) uses the following pattern for configuring the detail VC's view:
the detail VC's setters (for properties) are overwritten in order to invoke the configureView method (configureView would update all your controls in the view, e.g., labels, etc.)
the detail VC's viewDidLoad method also invokes the configureView method
I did not follow this pattern the other day when I was trying to re-use a detail VC in my movie app, and this gave me trouble.
I don't have much experience with popovers; however, if the pattern above is used with a detail VC that is displayed inside a popover, then wouldn't the detail VC's view get configured when you set the detail VC's properties from within the prepareForSegue method?

Holding NSView instances in an array

Is it possible to store an NSView object in a mutable array? As I understand it, the view will be an object so the array should be able to hold it. Specifically, I want to hold several instances of a nib file, which I think would be loaded with an NSNib init, and then addObject to the array.
The idea is to display an NSView in each of the rows of a column in a TableView. I think it can be done because iTunes does something similar (with what I think is an NSImage) in displaying album artwork in a list view.
Still, any knowledge on the subject (or link to an example or tutorial) would be very appreciated.
TableViews usually don't hold an NSView for each item. They hold a number of NSViewTableCells (which are, system-wise, far more lightweight than NSViews), and they re-use these cells. They usually don't have many more cells than necessary to display the visible part of the TableView, AFAIK, and when the view is scrolled, cells that have become "invisible" are re-used.
So the best way to do this is to subclass the cell and to make the TableView display the contents using these. Using NSViews for every entry in a list of, say, my MP3 albums would be extremely expensive.
In Xcode goto File->New File and choose Objective-C class then in the drop down, choose to make it a subclass of UITableViewCell. Name it MyCell (for example)
Next in interface builder, create a new XIB and change its owner to your newly created class. You may also want to delete the default view and add a UITableViewCell. Set the owner's view outlet to this new tableview cell. Then add whatever you want to the UITableViewCell.
Then create a new UIViewController (which it may be helpful to create a new UITableViewController first and then change its type to UIViewController just so you get all the UITableViewDelegate methods added for you) and choose to add a XIB file for the UIViewController. Open the header file for the newly created UIViewController and add UITableViewDelegate protocol so the header may look like this:
#interface MyViewController: UIViewController <UITableViewDelegate, UITableViewDataSource>
On the view for the view controller (in interface builder) add a UITableView and then set its datasource and delegates to the owner. Make sure to import the MyCell.h header file. Then implement the tableViewMethods in particular for your UITableViewCell you would do something like this:
- (UITableViewCell *)tableView:(UITableView *) tableView
cellForRowAtIndexPath:(NSIndexPath *) indexPath
{
static NSString *MyCellIdentifier = #"MyCellIdentifier";
MyCell *cell = (MyCell *)[tableView dequeueReusableCellWithIdentifier:MyCellIdentifier];
if (cell == nil) {
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:#"MyCell" owner:self options:nil];
cell = [nib objectAtIndex:0];
}
//Here you would set properties of the cells items like labels, etc.
return cell;
}

How to control a view with different UITableViewControllers based on parent table selection

I have a Split-View iPad application and I fixed the selections in the popover (RootViewController) to be static, let's say red, yellow, and blue. When my app starts I have preselected red or the top static text in the cell. I was able to add UITableViewDelegate and UITableViewDataSource with the other templates in DetailViewController. It's the one with the popover-no-popover default split-view app.
I added the row count and the cell method and voila' my test array populated the detail table. I want a separate controller (delegate and source) for each selection the user chooses to be driven from didSelectRowAtIndexPath in the RootViewController.
Should I just add the delegate and datasource templates to the DetailViewController and switch the data based on selections in the RootViewController view?
Or, would my multiple controller pattern be better design?
I would like some assistance as to how to get the outside controller to have control of the DetailViewController's UITableView. The DetailViewController is where I instantiate the add button and such to the toolbar. E.g. when I added the single (Red) test controller to the DetailViewController, any connection to the TableView wasn't seemingly automatic in IB. You could hover and then it would eventually connect to "View" (ultimately the UITableView). I've tried everything and I cannot get a simple delegate and datasource controller with a simple NSArray to populate the DetailViewController's table view from RootViewController's didSelectRowAtIndexPath. This method works because I've debugged and NSLogged the selections. I'm not creating my ProjectViewController (test or first static text in RootViewController) correctly. I'll paste some code that I've tried here too.
- (void)tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
// select static row and view controller
Punch *obj = [self.punchList punchAtIndex:indexPath.row];
NSLog(#"Selected punch object: %#", obj.name);
ProjectViewController *projectViewController = [[UITableViewController alloc] init];
[projectViewController tableView:detailViewController.tmpView];
}
The ProjectViewController code works if hard-coded in DetailViewController, i.e. the required methods, the count, and the array loaded cells and the I want this data population in separate controllers because I'm going to use Core-Data in the end.