Alan
Alan

Reputation: 1275

Extending the Utility Template

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?

Upvotes: 0

Views: 1028

Answers (2)

Jon Thomason
Jon Thomason

Reputation: 589

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 :)

Upvotes: 1

Eric Petroelje
Eric Petroelje

Reputation: 60569

In rootViewController.h, looks like your declaration line:

docViewController *docViewController;

Should be:

FlipsideViewController *docViewController

Upvotes: 0

Related Questions