期望的说明符 - 限定符 - 列表 - 为什么?

时间:2011-04-19 21:54:12

标签: objective-c ios syntax

我有一个我正在研究的应用程序,它到目前为止有4个视图工作正常,我添加了另一个视图(带.h和.m文件),现在它不会编译。我已经从其他行复制了代码,但无法弄清楚问题。

错误在线IBOutlet fifthViewController * fifthViewController;

#import <UIKit/UIKit.h>
@class FirstViewController;
@class SecondViewController;
@class ThirdViewController;
@class ForthViewController;
@class fifthviewcontroller;

@interface MulipleViewsViewController : UIViewController {
    IBOutlet FirstViewController *firstViewController;
    IBOutlet SecondViewController *secondViewController;
    IBOutlet ThirdViewController *thirdViewController;
    IBOutlet ForthViewController *forthViewController;
    IBOutlet fifthViewController *fifthViewController;
}

@property (retain, nonatomic) FirstViewController *firstViewController;
@property (retain, nonatomic) SecondViewController *secondViewController;
@property (retain, nonatomic) ThirdViewController *thirdViewController;
@property (retain, nonatomic) ForthViewController *forthViewController;
@property (retain, nonatomic) fifthviewcontroller *FifthViewController;

-(IBAction) loadSecondView:(id)sender;
-(IBAction) loadThirdView:(id)sender;
-(IBAction) loadFirstView:(id)sender;
-(IBAction) loadForthView:(id)sender;
-(IBAction) loadFifthView:(id)sender;

-(void) clearView;

@end

2 个答案:

答案 0 :(得分:2)

我认为问题在于:

@property (retain, nonatomic) fifthviewcontroller *FifthViewController;

它应该是:

@property (retain, nonatomic) Fifthviewcontroller *fifthViewController;

当然

IBOutlet fifthViewController *fifthViewController;

应该是:

IBOutlet FifthViewController *fifthViewController;

这里也是:

@class fifthviewcontroller;

应该是

@class FifthViewcontroller;

答案 1 :(得分:0)

当您声明类和属性时,使用没有大写的fifthviewcontroller,但是当您声明实例变量时,您将V和C大写:fifthViewController。从上下文来看,似乎大写是一个错误,该行应该更改为IBOutlet fifthviewcontroller *fifthViewController;

将来,在发布错误时,请在代码中注明错误发生在哪一行。