Objective-C属性访问 [英] Objective-C Property Access

查看:129
本文介绍了Objective-C属性访问的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通过foo.property到[foo property]访问对象的属性或方法有什么区别?

What is the difference in accessing an objects properties or methods via foo.property to [foo property]?

推荐答案

没事!点符号是在Objective-C 2.0中引入的语法糖".实际上,编译器在编译时会将foo.property转换为[foo属性],因此它们可以编译为完全相同的东西.

Nothing! Dot-notation is "syntactic sugar" introduced in Objective-C 2.0. In fact, the compiler converts foo.property to [foo property] during compile-time, so they compile to exactly the same thing.

这只是您喜欢的问题.

这篇关于Objective-C属性访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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