Question

Extending the Utility Template

I'm working with the Xcode Utility template (Mainside/Flipside) and I need to add a new screen. I've added:

 docView.xib (copy of FlipsideView.xib)
 docView.m
 docView.h
 docViewController.m
 docViewController.h

In rootViewController.h I added:

 UINavigationBar *docNavigationBar;
 docViewController *docViewController;

 @property (nonatomic, retain) UINavigationBar *docNavigationBar;
 @property (nonatomic, retain) docViewController *docViewController;

In rootViewController.m, I synthesized the additions:

 @synthesize docNavigationBar;
 @synthesize docViewController;

I do import my .h into rootViewController.m:

   #import "docViewController.h"   

When I try to compile I error out with:

RootViewController.m:22: error: syntax error before 'docViewController'

Warnings:

RootViewController.m:160: warning: property 'docViewController' requires method       '-docViewController' to be defined - use @synthesize, @dynamic or provide a method implementation

RootViewController.m:160: warning: property 'docViewController' requires the method 'setDocViewController:' to be defined - use @synthesize, @dynamic or provide a method implementation

What have I missed?

Was it helpful?

Solution

Actually, I think he meant to have put docViewController (it's new view controller, right?). In any case, if this is what you meant, and not FlipsideViewController as Eric says, then your problem is that you named it the same as the property. Bad idea. Normal objective-C convention is to uppercase the first letter of your class names, then lowercase them when you use them as properties, etc.

docViewController *docViewController;

should be:

DocViewController *docViewController;

It will work a lot better that way :)

OTHER TIPS

In rootViewController.h, looks like your declaration line:

docViewController *docViewController;

Should be:

FlipsideViewController *docViewController
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top