“-(void)"是什么意思?在这个函数声明中是什么意思?`-(void)awakeFromNib` [英] What does "-(void)" mean in this function declaration? `-(void)awakeFromNib`

查看:40
本文介绍了“-(void)"是什么意思?在这个函数声明中是什么意思?`-(void)awakeFromNib`的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么每次我必须使用awakeFromNib 协议时,我必须把它放在这种格式中?

How come whenever I have to use awakeFromNib protocol I have to put it in this format?

-(void)awakeFromNib

需要什么 -(void)?

What is the need for -(void)?

推荐答案

-(void) 用于方法的声明.据推测,您正在定义它以供其他人调用,而不是自己调用.

The -(void) is used in the declaration of the method. Presumably, you are defining it for someone else to call, rather than calling it yourself.

- 符号表示该方法是实例方法,而不是类方法.它需要一个对象来调用它,并且对象的实例变量在它的定义中是可用的.

The - sign indicates that the method is an instance method, as opposed to a class method. It requires an object to call it, and instance variables of the object are available to it inside its definition.

(void) 表示返回类型.这个方法不返回任何东西,所以它的结果不能赋值给任何东西.

The (void) indicates the return type. This method doesn't return anything, so its result can't be assigned to anything.

这篇关于“-(void)"是什么意思?在这个函数声明中是什么意思?`-(void)awakeFromNib`的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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