小编Kyl*_*ang的帖子

我们可以将IBOutlets列入一个类别吗?

由于ViewController代码太大,我想知道如何将代码分成多个文件.这是我遇到的问题:

// In the original .m file, there are bunch of outlets in the interface extension.
@interface aViewController()
@property (weak, nonatomic) IBOutlet UIView *contentView1;
@property (weak, nonatomic) IBOutlet UIView *contentView2;
@property (weak, nonatomic) IBOutlet UIView *contentView3;
@end
Run Code Online (Sandbox Code Playgroud)

我想根据三种不同的观点将文件分成3个类别.

// In category aViewController+contentView1.m file
@interface aViewController()
@property (weak, nonatomic) IBOutlet UIView *contentView1;
@end
Run Code Online (Sandbox Code Playgroud)

contentView1但是,如果删除原始插座,则无效.

问题
为什么我必须将contentView1插座保留在原始.m文件中?

objective-c ios

3
推荐指数
1
解决办法
1205
查看次数

标签 统计

ios ×1

objective-c ×1