在头文件与实现文件目标C中定义属性 [英] Defining properties in header file vs implementation file objective c

查看:62
本文介绍了在头文件与实现文件目标C中定义属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在基于页面的应用程序模板中,我在实现(.m)文件中看到了很多.

In the page based application template, I am seeing this a lot in the implementation (.m) files.

@interface ModelController()
@property (readonly, strong, nonatomic) NSArray *pageData;
@end

为什么没有在头(.h)文件中完成此操作?

Why isn't this done in the header (.h) file?

推荐答案

此属性在实现文件中,因为它不需要公开声明,而仅在.m文件中使用.

This property is in the implementation file because it does not need to be declared publicly and only used within the .m file.

这篇关于在头文件与实现文件目标C中定义属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆