【发布时间】:2015-05-08 01:05:45
【问题描述】:
我有一个 UICollectionView 填充了具有自定义类的单元格,每个单元格都有 3 个标签一个图像,我刚刚添加了一个按钮,在添加按钮之前一切正常,现在我添加了按钮并将其连接到自定义单元格类(我还连接了标签和图像) 填充 UICollectionView 时应用程序崩溃。 在连接检查器上,按钮只有将他连接到自定义单元类(如其他元素)的 Outlet,所以为什么应用程序会崩溃? 这是我的头文件:
#import <UIKit/UIKit.h>
@interface CollectionViewCell : UICollectionViewCell
@property (weak, nonatomic) IBOutlet UIButton *TestButton; //this one is the button that causes the crash
@property (weak, nonatomic) IBOutlet UILabel *titleP;
@property (weak, nonatomic) IBOutlet UILabel *price;
@property (weak, nonatomic) IBOutlet UILabel *codeP;
@property (weak, nonatomic) IBOutlet UIImageView *img;
@end
编辑: 我不知道 StoryBoard 发生了什么,但我只需要清理项目,一切正常,感谢大家的帮助。
【问题讨论】:
-
显示整个错误信息。
-
还有钥匙。和代码。真的是 TestButton 还是 testButton?
标签: objective-c uicollectionview