tags:

views:

69

answers:

2

I called function of one view controller class from other view controller in nib file using first responder before.But now I want to do it programatically.

Suppose,I have a 2 controller class named A and B.where B is root controller.I have a button(added programatically)named (Btn) in my A controller class.now I want to call function( FuncB) of Class B when I pressed Btn of Class A.how can I do this??

I dont have any nib file in my class A. plz someone ans my question. Advanced thanks for ur reply.

+1  A: 

I'm not sure whether I've interpreted your question correctly, but if b is an object instance of the B class, and methodB is a method of the B class, you can call methodB via:

[b methodB];

I am assuming by "function", you actually mean "method"...?

Steve Harrison
+1  A: 

Alloc and init an instance of this class and call your method. Class "functions" are called methods.

BController *myBController = [[BController alloc] init]; // alloc and init Controller B
[myBController MethodB]; // Call your class method
[myBController release]; // release your instance object

Any questions? Just comment.

Henrik P. Hessel