i've 2 questions:
1) in 1 of viewcontrollers write method find customized shake:
- (void)accelerometer:(uiaccelerometer *)accelerometer didaccelerate:(uiacceleration *)acceleration;
and express accelerometer delegate in .h
the problem iphone simulator doesn't detect it, normal?
2) previous code in viewdidload write:
uiaccelerometer *accell = [uiaccelerometer sharedaccelerometer]; [accell setdelegate:self]; [accell setupdateinterval.....];
now want make delegate class, not write code each viewcontroller. how can this? how change code above?
in way:
delegateclass *delegateacceleration = [[delegateclass alloc]]init]; uiaccelerometer *accell = [uiaccelerometer sharedaccelerometer]; [accell setdelegate:delegateacceleration]; [accell setupdateinterval.....]; [delegateacceleration release];
1) yes normal, simulator doesn't support accelerometer. there third party tools can it, isimulate. run on device , send acceleration data app running in simulator
2) wrong, cannot release delegate class because uiaccelerometer doesn't retain delegate, if release right away break.
Comments
Post a Comment