1

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.

2 Answers 2

1

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"...?

Sign up to request clarification or add additional context in comments.

Comments

1

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.