0071 How can I call a method from ofBaseApp to ofxiPhoneViewController

Hi,

I’m using 0071 ios and I’ve checked iosNativeExample, it’s really good example I think.

What I would like to know is that how can I call the mehod which is defined on ofxiPhoneViewController subclass from the application, launched from the same subclass ( ofxiPhoneViewController ).

For Instance, Refer to iosNaviveExample…

Because the ‘CircleApp’ is lanched via the CircleAppViewController which extends ofxiPhoneViewContrller, I guess I can call the method I implement on the CircleAppViewController.

I’ve made sure that the CircleApp(CircleApp.mm) can get the ptr of the CircleAppViewController,
so I just write the code like folling.

However, I cannot call the test() method from CircleApp.mm.
I realize that I am short of the knowledge c++ though…

Please Any advice !

Thanks.

CircleApp.mm

  
  
#import "CircleAppViewController.h"  
  
void CircleApp::touchDown(ofTouchEventArgs &touch){  
    cout << "pointer view controller = " << ofxiPhoneGetViewController() << endl;  
    CircleAppViewController* ptr = (CircleAppViewController*)ofxiPhoneGetViewController();  
    ptr->test();  
}  
  

CircleAppViewController.h

  
  
#import "ofxiPhoneViewController.h"  
@interface CircleAppViewController : ofxiPhoneViewController  
- (void)test;  
@end  
  

CircleAppViewController.mm

  
  
#import "CircleAppViewController.h"  
#import "ofxiPhoneExtras.h"  
  
@implementation CircleAppViewController  
- (void)test  
{  
    NSLog(@"test");  
}  
- (id) initWithFrame:(CGRect)frame app:(ofBaseApp*)app {  
  
    ofxiPhoneGetOFWindow()->setOrientation( OF_ORIENTATION_DEFAULT );   //-- default portait orientation.      
   
    return self = [super initWithFrame:frame app:app];  
}  
  
- (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {  
    return NO;  
}  
@end