Tutorial details

Counting timer | App Code for Sale | Preview

Counting timer | iOS Tutorial

How to create a counting timer

Overview PAGE TOP

Reference: http://www.geekylemon.com/WEBPROTECT-xcodecountingtimer.htm

In this tutorial i will be showing you how to create a counting timer

Feature:

  • 1 Round Rect Button
  • 1 Label

Counting timers are great for game for example mafia wars on Facebook every hour you receive you income from properties and are helpful for counting over a certain period

ViewController.h PAGE TOP

@interface ViewController :UIViewController {
IBOutlet UILabel *seconds;
NSTimer *timer;
int MainInt;
}
-(IBAction)start:(id)sender;
-(void)countup;
@end

ViewController.m PAGE TOP

@implementation ViewController
-(void)countup {
MainInt += 1;
seconds.text = [NSString stringWithFormat:@"%i", MainInt];
}
-(IBAction)start:(id)sender {
MainInt = 0;
timer = [NSTimer scheduledTimerWithTimeInterval:1.0
target:self selector:@selector(countup)userInfo:nil repeats:YES];
}
@end

Reference PAGE TOP

http://www.geekylemon.com/WEBPROTECT-xcodecountingtimer.htm

0 Comments Leave a comment

Please login in order to leave a comment.

Newest first
!

Sign-in to your Chupamobile Account.

The Easiest way to Launch your next App or Game.

Join Chupamobile and get instant access to thousands of ready made App and Game Templates.

Creating an account means you’re okay with Chupamobile’s Terms of Service and Privacy Policy.