hi i am new to iphone. what i need is i have to call a function named (void)mymethod from classA to classB. how can i call pls post some code thank u in advance.
A:
You need to create an object and then you can call a method on it. For example, you could have this in classA.
ClassB *object = [[ClassB alloc] init];
[object mymethod];
rickharrison
2010-09-02 04:56:07
this gives a warning classA may not respond to mymethod,and in console it displays Application tryed to push nil view
MaheshBabu
2010-09-02 05:02:44
A:
hi mahesh,
Make Sure you have declared the previousCallMethod
in MyPreviousClass.h file also.
MyPreviousClass *objMyPreviousClass = [[MyPreviousClass alloc] init];
[objMyPreviousClass previousClassMethod];
in your case (In ClassB)
ClassA *objClassA = [[ClassA alloc] init];
[objClassA mymethod];
But in this case also make sure you have declared mymethod
in ClassA.h
hAPPY cODING...
Suriya
2010-09-02 06:43:31