#import <UIKit/UIKit.h>
@interface elcuiapplication: uiapplication
{
nstimer *_idletimer;
Nsinteger timecount;
}
@end
#import "ELCUIApplication.h"
@implementation elcuiapplication
-(void) Sendevent: (uievent *) event {
[Super sendevent: event];
if (_idletimer= =Nil) {
[self resetidletimer];
}
nsset *alltouches = [Event alltouches];
if ([Alltouches count] > 0) {
uitouchphase Phase = ((uitouch *) [alltouches anyobject]). Phase;
if (phase = = Uitouchphasebegan) {
[self resetidletimer];
}
}
}
-(void) Resetidletimer
{
Timecount=3;
if (_idletimer= =Nil) {
_idletimer = [nstimer timerwithtimeinterval:1 target: self Selector:@selector(idletimerexceeded) userInfo:nil repeats:YES ];
}
nsrunloop* run=[nsrunloop currentrunloop];
[Run addtimer:_idletimer formode:nsdefaultrunloopmode];
}
-(void) idletimerexceeded
{
Timecount--;
if (timecount>=0) {
NSLog(@ "%ld", (long)timecount);
}Else{
NSLog(@ " lock frequency Notification issued ");
Timecount=3;
}
}
@end
#import <UIKit/UIKit.h>
#import "AppDelegate.h"
#import "ELCUIApplication.h"
int Main (int argc, Char * argv[]) {
@autoreleasepool {
return uiapplicationmain(argc, argv, @ "Elcuiapplication", nsstringfromclass([ appdelegate class]));
}
}
iOS Auto lock screen