AppController.h客觀C++從C訪問一個NSSlider ++回調
@interface AppController : NSObject {
}
@property (retain) IBOutlet NSSlider * mySlider;
void setMySlider (NSSlider *ns);// c function
AppController.m
@implementation AppController
int myAmount=0;
@synthesize mySlider;
void setMySlider(NSSlider *mySlider){
[ns setIntValue:10]; //ok
ns.intValue =myAmount;//ok
}
myCallBackFunction(double delta,std::vector<unsigned char>*myData,void *userData){
myAmount=50;
NSLog(@"%i", myAmount); // ok does display value of myAmount
// should move my slider the value of my amount by calling the following C function:
changeSliderVelocity(mySlider);// error message mySlider was not declared in this scope
}
請寫出你的問題顯然 – Dominic 2011-02-23 20:13:31