开发者

How to call and declare object for a method call in iOS

开发者 https://www.devze.com 2023-04-01 17:30 出处:网络
Say have \"normal\" class开发者_如何学运维 in iOS, called A. I\'d like to pass this as a parameter to class B, method \"myMethod\".

Say have "normal" class开发者_如何学运维 in iOS, called A. I'd like to pass this as a parameter to class B, method "myMethod".

"A" is declared as a pointer:

A       *myA;

I'm unclear as to the syntax of call. Here's the method (I think this is probably correct:

- (void *) myMethod:(A *) myA 

Should the call be

[b myMethod:myA]

or

[b myMethod:&myA]

Since myA is a pointer, it's seems it should be the second one, but somehow I'm thinking it's the first.


It's the first:

[b myMethod:myA]

I rarely dereference pointers in Objective-C as I used to do in C/C++.

0

精彩评论

暂无评论...
验证码 换一张
取 消