简体   繁体   English

将Ecmascript(Java,javascript,Actionscript)知识转换为目标C

[英]translating Ecmascript (Java,javascript,Actionscript) knowledge to Objective C

Newcomer to Objective C and trying to translate concepts and sytax I know from ecmascript based languages to Objective C. 目标C的新手,并尝试将我从基于ecmascript的语言转换为目标C的概念和语法。

Is it proper to think of the .h header file in ObjectiveC as an Interface in Actionscript? 将ObjectiveC中的.h头文件视为Actionscript中的接口是否合适?

Lets take the following code example in Objective C which calls a method containing 2 arguments 让我们以目标C中的以下代码示例为例,该示例调用包含2个参数的方法

[myTextObject setString: @"Hello World" color: kWhiteColor];

In Actionscript(or javascript) would this be the same as calling 2 accessor methods on 'myTextObject'? 在Actionscript(或javascript)中,这是否与在“ myTextObject”上调用2个访问器方法相同? ie

myTextObject.setString("Hello World")
myTextObject.color(kWhiteColor);

I see it like a function with 2 arguments in actionscript because you not just set some values, you call a method and you use them both. 我认为它就像一个在动作脚本中具有2个参数的函数,因为您不仅设置了一些值,还调用了一个方法,并且同时使用了它们。 Kind of: set (string, color); 种类:集合(字符串,颜色);

Yes, that would be the same. 是的,那是相同的。 Actually objetive-c also supports the dot syntax in some situations. 实际上objetive -c在某些情况下也支持点语法。

[myTextObject setString:@"Hello World"];

is the same as 是相同的

myTextObject.string = @"hello world";

(objective-c automatically calls the setString method, when you write myTextObject.string = @"something") (当您编写myTextObject.string = @“ something”时,objective-c自动调用setString方法)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM