开发者

iOS - Passing Values from an Object to it's Containing Class

The setup:

I have an AppDelegate and declared on that is CustomUIViewController.h and in that controller I have RandomName.h declared (as an object, not a subclass) can I use [super methodName] or similar to trigger a method on CustomUIVie开发者_JAVA技巧wController from a method on RandomName.h?

Or do I have to pass it to the appDelegate and then from there to CustomUIViewController? (How I have been doing it)

Thanks

P.S. Coffee is good.


I think I've understood your question. Pardon me if I didn't ;-)

super doesn't work that way. You can simply call,

[appDelegate.customViewController methodName];

The other way is to pass the reference of the customViewController to RandomName object, something like,

[[RandomName alloc] initWithParent:self];

You have to keep the reference of self in initWithParent method, lets say the variable name is parent, and call the method like this,

[parent methodName];
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜