Touch timeout

Touch timeout

Released 4 years ago , Last update 4 years ago

Kiosk timer monitors device for touch so the app can be reset to the initial view whenever not in use. The demo resets to a signup form which users must fill out to gain access to the app but you can use any view you want.

This is simple to implement and enables the ability to push a view automatically after a specified period of time has lapsed without any user interaction.

Notes: The timer will start anytime a touch is detected. This means that if the user touches the main screen (in my case "mainView") even without navigating away from that view, the same view will push over itself after the allotted time. Not a big deal for my app, but for yours it might be. The timer will only reset once a touch is recognized. If you want to reset the timer as soon as you get back to the page you want to be at, include this code after the ...pushViewController:controller animated:YES];


5 day 5-day money-back guarantee



The GNU LGPL is an open-source license.


Step 1

Drop the kioskMode header and implementation file into your project and open up the header file to line 10.

Set the following line to the amount of time in minutes you want the timer to be set for.

#define kioskTimeout 4

That's all you need to do in that file.

Step 2

Open up your project support file main.m and add a line to import the kioskMode.h file and add it as a subclass to UIApplicationMain like this..

#import "kioskMode.h"

int main(int argc, char *argv[]) {
    @autoreleasepool {
        return UIApplicationMain(argc, argv, NSStringFromClass([kioskMode class]), NSStringFromClass([AppDelegate class]));

Step 3

Open up your AppDelegate.m file and import the kioskMode.h file and set it up to monitor the event that will be triggered on timeout like this..

#import "kioskMode_UIApplication.h"

- (BOOL) application : (UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationDidTimeout:) name:kioskDidTimeout object:nil];

    return YES;

- (void) applicationDidTimeout : (NSNotification *) notif
    NSLog (@"timeout");
    // add view here

To reset the timer manually you can call this after pushViewController:

[(kioskTimer *)[UIApplication sharedApplication] resetIdleTimer];

What's Included?

When you download this project you'll get a complete demo that you can drop right into any project. Included you'll find the timer, as well as a demo viewController, and demo files for each of the files you'll need to modify without your project.

There are inline examples of how to set this up using a XIB viewcontroller or if you prefer to use Storyboards there is some demo code for storyboards as well that you'll just have to uncomment.

Not to worry, this is all covered with easy to follow step by step instructions in a file that you'll get when you download the project. I highly suggest that you always thoroughly read through all the documentation before using any code that you download.

The provided step by step setup instructions should have you up and running in no more than a few minutes.

License » GNU LGPL Download

Get A Quote

What do you need?
  • Custom development
  • Integration
  • Customization / Reskinning
  • Consultation
When do you need it?
  • Soon
  • Next week
  • Next month
  • Anytime

Thanks for getting in touch!

Your quote details have been received and we'll get back to you soon.

Or enter your name and Email
No comments have been posted yet.