Wednesday, December 3, 2008

NSTimer

timer = [[NSTimer scheduledTimerWithTimeInterval:1 // every one second
target:self
selector:@selector(handleTimer:)
userInfo:nil
repeats:YES]
retain];


- (void)handleTimer: (NSTimer *) timer
{
[self refreshTime];
}

Monday, December 1, 2008

Put App running on background

- (void)applicationSuspend:(struct __GSEvent *)fp8
{
[textView setText: @" in applicationSuspend"];

int i = 0;
while ( i < 5) {
GSEventPlaySoundAtPath(@"/System/Library/CoreServices/SpringBoard.app/unlock.
aiff");
i++;
sleep(1);
}

[self terminate];
}