views:

55

answers:

1

Hi all! I made a viewcontroller that works fine on my iphone, I inserted this viewcontroller into an ipad app, sent the .app to my friend but the accelerometer didn't work... here is the code I used:

into the declaration I added:

<UIAccelerometerDelegate>

this into my viewconotrller code

- (void)viewDidLoad {
    [super viewDidLoad];
    [[UIAccelerometer sharedAccelerometer] setUpdateInterval:1.0 / kUpdateFrequency];
    [[UIAccelerometer sharedAccelerometer] setDelegate:self];   
}

and after:

- (void)accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration {
    accelValueX.text = [NSString stringWithFormat:@"x: %0.3f", acceleration.x];
    accelValueY.text = [NSString stringWithFormat:@"y: %0.3f", acceleration.y];
    accelValueZ.text = [NSString stringWithFormat:@"z: %0.3f", acceleration.z]; 
}

but the 3 label didn't change the text.... the only difference between iphone and ipad is that on iphone the viewcontroller is the base viewcontroller, and on the ipad I added the view controller like this:

accel = [[AccelerationViewController alloc] initWithNibName:@"AccelerationViewController" bundle:[NSBundle mainBundle]];
accel.view.frame = CGRectMake(2, 46, 1020, 720);
[self.view addSubview:accel.view];
A: 

solved... in the interface builder I forgot to link labels to the accelValueX.... :(

ghiboz