ios - 在 Objective-C 中调用 setter

标签 ios objective-c variables properties setter

假设我们在 Objective-C 类中有一个属性。并且我们在实现文件中综合了它。这样就生成了setter和getter。我们可以通过编写 self.variable[self variable] 来调用属性的 getter。我们也可以这样调用setter [self.variable setVariable: value]; 但是如果我们写 self.variable = value; 在这种情况下调用的是 setter 还是其他东西例如 operator = function

谢谢;

最佳答案

的情况下

self.variable = value;

[self setVariable:value]

被调用。

关于ios - 在 Objective-C 中调用 setter,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25488057/

相关文章:

ios - 执行某些说明后无法从一个 View 转到另一个 View

ios - Cocoapods iOS - [!] Google 已被弃用 - 如何摆脱警告?

objective-c - 在访问Objective C属性时可以具有参数吗?

objective-c - 什么是 ARC 限制,如何删除它们?

java - 将数组操作为新数组

ios - watchOS 3 是否支持 SpeechKit 框架?

iphone - iPhone 上的自定义光栅/矢量 map

ios - 如何从 pdftron 的 webviewer 中的 tmp 文件夹加载文档?

linux - Bash 脚本变量作用域问题

c++ - 一个全局对象是如何在它被声明为 const 之前构造的?