I have created a class (TestAccel) that implements UIAccelerometerDelegate. I have a private var in this class for UIAccelerometer.
UIAccelerometer *accel;
The class init looks like this:
- (id) init:(id)actOnThisInstance{
[self init];
accel = [UIAccelerometer sharedAccelerometer];
accel.delegate = actOnThisInstance;
return self;
}
The caller (a ViewController) initializes like this
accel = [[Acc alloc]init:self];
TestAccel never receives any notifications to its implementation of shouldAutorotateToInterfaceOrientation. I then implement UIAccelerometerDelegate in the caller. The caller receives notifications but TestAccel still receives nothing. Any ideas what I'm doing wrong?
My goal is to create a class that is self contained in handling UIAccelerometerDelegate notifications for a calling class. I'd like the caller to not implement UIAccelerometerDelegate but not sure if that is possible.