了解此“使用”(私人)在@interface声明 [英] Understanding this use of "(Private)" in @interface declaration

查看:137
本文介绍了了解此“使用”(私人)在@interface声明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看过一些代码写成这样:

I've seen some code written this way:

@interface AViewController(Private)

我想知道(Private)应用商店?

推荐答案

这是一个名为Private的类别。

It's a category called 'Private'.

请查看

Have a look in the Categories and Extensions chapter of the Objective-C programming reference

是为了方便起见已被命名为Private的AViewControler类的添加。

What it means is that it is an addition to the AViewControler class that has been named 'Private' for convenience. It could have been called anything or even left blank to create a class extension.

您可以在自己的代码中创建您的应用程序可以调用的私有方法。这实际上是好的做法,因为它表示正确的封装(虽然在Objective-C中没有像私有方法这样的东西)。如果您不希望您的应用程序从App Store中被拒绝,那么您不允许在代码中使用iOS框架的私有方法。

You can create private methods in your own code that your app can call. This is actually good practice because it indicates proper encapsulation (although there is no such thing as a private method in Objective-C). What you aren't allowed to do is to use private methods of the iOS frameworks in your code if you don't want your app rejected from the App Store.

这篇关于了解此“使用”(私人)在@interface声明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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