gpt4 book ai didi

objective-c - 如何从 Objective C 中的另一个方法调用一个方法?

转载 作者:太空狗 更新时间:2023-10-30 03:46:17 25 4
gpt4 key购买 nike

有人能回答我如何在 Xcode 上的 Objective C 中将一种方法调用到另一种方法吗

最佳答案

调用对象方法的基本语法是这样的:

[object method]; 
[object methodWithInput:input];

如果方法返回值:

output = [object methodWithOutput]; 
output = [object methodWithInputAndOutput:input];

More Detail


编辑:

这是一个很好的例子,说明如何从其他类调用方法:

OBJECTIVE C - Objective-C call method on another class?

示例:

SomeClass* object = [[SomeClass alloc] init]; // Create an instance of SomeClass
[object someMethod]; // Send the someMethod message

关于objective-c - 如何从 Objective C 中的另一个方法调用一个方法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3911593/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com