在Objective-c中,如果未提供默认值,则字段的默认值是多少? [英] In objective-c, what is the default value for a field if no default value is provided?

查看:81
本文介绍了在Objective-c中,如果未提供默认值,则字段的默认值是多少?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在objective-c中,如果未提供默认值,则字段的默认值是多少?
例如UIButton,NSArray,NSMutableSet,UIActivityIndi​​catorView,int,BOOL

In objective-c, what is the default value for a field if no default value is provided? eg UIButton, NSArray, NSMutableSet, UIActivityIndicatorView, int , BOOL

实例变量默认值和局部变量默认值有什么区别?

And what is the different between instance variable default value and local variable default value ?

推荐答案

实例变量在分配时由运行时清零(false,NO,nil,NULL等)。堆栈变量没有设置默认值。它们将包含内存中的所有内容,然后再放入其中。

Instance variables are zeroed by the runtime on allocation (false, NO, nil, NULL, whatever). Stack variables have no default value set; they'll contain whatever was in memory before they were put there.

这篇关于在Objective-c中,如果未提供默认值,则字段的默认值是多少?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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