Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

mcannell

macrumors member
Original poster
Dec 20, 2008
36
0
I am new to Objective-C, Cocoa, & iPhone SDK.

This seems to me like it should be very easy to do but I have spent hours trying to find the solution.

I have a RootViewController with a method in it that I want to call from MainView.m. Why isn't this a very simple thing to do? I've searched, read through Objective-C books, begged, nothing works...



RootViewController.m
---------------------------------

-(void) myMethod {
// do something amazingly great
}


MainView.m
----------------------------------
#import "MainView.h"
#import "RootViewController.h"

-(IBAction) myOutlet{
// do some calculations here
// set some variables here

//Now call method inside RootViewController
[RootViewController toggleView];

}
 

mcannell

macrumors member
Original poster
Dec 20, 2008
36
0
BTW, It builds but when the button is clicked I get:


__TERMINATING_DUE_TO_UNCAUGHT_EXCEPTION__

0x95490fb0 <+0000> push %ebp
0x95490fb1 <+0001> mov %esp,%ebp
0x95490fb3 <+0003> int3
0x95490fb4 <+0004> leave <---------------------------------- red arrow here
0x95490fb5 <+0005> ret
0x95490fb6 <+0006> nopw %cs:0x0(%eax,%eax,1)
 

dejo

Moderator emeritus
Sep 2, 2004
15,982
452
The Centennial State
Well, I won't give you the outright answer but I will give you somewhat of a hint. You have myMethod declared as an instance method but you are trying to access it using the class method approach.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.