所有这些错误都是什么?

时间:2010-10-27 05:58:48

标签: objective-c xcode

#import <UIKit/UIKit.h>


@interface ProfileViewController : UIViewController {
    UIImageView *profPic;
    UILabel *name;
    UILabel *hosted;
    UILabel *points;
    UILabel *attended:
    UITableView *tableView;
}

@property (nonatomic, retain) IBOutlet UIImageView profPic;
@property (nonatomic, retain) IBOutlet UILabel name;
@property (nonatomic, retain) IBOutlet UILabel hosted;
@property (nonatomic, retain) IBOutlet UILabel points;
@property (nonatomic, retain) IBOutlet UILabel attended:
@property (nonatomic, retain) IBOutlet UITableView tableView;

@end

3 个答案:

答案 0 :(得分:2)

虽然您尚未公布错误,但您的代码中存在两个明显的问题:

  1. 行尾的冒号应该是分号:

    @property (nonatomic, retain) IBOutlet UILabel attended:
                                                          ^^^
    
  2. 属性类型应该是指针(在属性声明中忽略'*')

    @property (nonatomic, retain) IBOutlet UILabel* attended;
    

答案 1 :(得分:2)

那些UI *对象应该是指针:

IBOutlet UIImageView * profPic;

答案 2 :(得分:1)

@property (nonatomic, retain) IBOutlet UIImageView *profPic;

在对象名称前添加星号(*)。