Check out CodeRage 6 for a cool implementation!
Enjoy!
implementation
{$R *.lfm}
type
UIAcceleration = objcclass external (NSObject)
public
function timestamp: NSTimeInterval; message 'timestamp';
function x: UIAccelerationValue; message 'x';
function y: UIAccelerationValue; message 'y';
function z: UIAccelerationValue; message 'z';
end;
AccDelegate = objcclass(NSObject)
procedure accelerometer_didAccelerate(accelerometer: UIAccelerometer; acceleration: UIAcceleration); message 'accelerometer:didAccelerate:';
end;
var
AccDelegatVar: AccDelegate;
procedure AccDelegate.accelerometer_didAccelerate(accelerometer: UIAccelerometer; acceleration: UIAcceleration);
begin
// Do whatever you want to with acceleration.x, y and z here!
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
UIAccelerometer.sharedAccelerometer.setUpdateInterval(1.0 / kAccelerometerFrequency);
AccDelegatVar := AccDelegate.alloc;
UIAccelerometer.sharedAccelerometer.setDelegate(AccDelegatVar);
end;
All these tips should be compiled into a wiki, the Delphi help, a book, or a code library or something.
ReplyDeleteAs soon as I start doing iOS stuff, I'll have to come back to look at all these tips. They look very helpful, but unfortunately I can't do anything with them yet.
Once they are fleshed out, I will do a better write up. For now I blog about the tips and tricks as I crack each one open. Also, CodeRage 6 during the week of October 17-21 will cover all of this.
ReplyDeleteYou're actually a fantastic web marketer. The site reloading velocity will be wonderful. It would appear that you're performing virtually any unique technique free course. As well, This belongings are usually must-see. you could have carried out an excellent process with this subject!
ReplyDelete