Minute to midnight in Iphone


In this tutorial we will see the app is "Minutes to Midnight" is simply a countdown of the time left before the day ends. This is the view based apps.

Here are some steps for it…



1. Open the xcode & choose "File->New Project".

2. Select "Application" from left menu and then "View-based Application".

3.Name your project as "MinutesToMidnight" and save the project.

4.Now just select "timerViewController.h" file from left menu for define a UILabel . Set the property for UILabel.

 

 

#import <UIKit/UIKit.h>


@interface timerViewController : UIViewController {

IBOutlet UILabel *timeLabel

NSTimer *timer;


}

@property(nonatomic,retain) UILabel *timeLabel; 

-(void)onTimer;

@end

 

5. Now select "timerViewController.m" file from menu for implementation.

- (void)viewDidLoad {

 

    [super viewDidLoad];

 

[timeLabel setFont:[UIFont fontWithName:@"DBLCDTempBlack" size:128.0]];



 

timer=[NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(onTimer) userInfo:nil repeats:YES];

 


}


-(void)onTimer{


NSDate *time=[NSDate date];

int hour=23-(int)[[time dateWithCalendarFormat:nil timeZone:nil] hourOfDay];

int min=59-(int)[[time  dateWithCalendarFormat:nil timeZone:nil] minuteOfHour];

int sec =59-(int)[[time dateWithCalendarFormat:nil timeZone:nil] secondOfMinute];

timeLabel.text=[NSString stringWithFormat:@"%2d:%2d:%2d",hour,min,sec];


}

- (void)dealloc {

    [super dealloc];

}


@end

 

 

6. Now double click on "timerViewController.xib" from Resource folder for open it.


7. On the view window drag the label from library . Then link the label  to the File's Owner. 


8. Then Quit and Save the Interface Builder.


9. Now you are ready for  click on "Build & Go" button. 


Now you can see the output in iphone simulator .




(11) Responses to this post

Anamika Feb 17 2011 at 11:04:51

Great working

Adam Feb 18 2011 at 06:12:32

nice working dude.......

Bobbi May 05 2011 at 04:51:02

BION I'm ipmressed! Cool post!

mrilymzwo May 05 2011 at 22:08:14

L8PDeL vjrbqjybsgcm

back link service Oct 24 2011 at 15:15:34

what's up iphonetut.com owner discovered your website via yahoo but it was hard to find and I see you could have more visitors because there are not so many comments yet. I have found site which offer to dramtically increase traffic to your website http:/

backlinks Nov 15 2011 at 12:30:09

good day iphonetut.com owner found your site via Google but it was hard to find and I see you could have more visitors because there are not so many comments yet. I have discovered site which offer to dramatically increase traffic to your website http://x

backlink service Dec 11 2011 at 08:54:22

Most powerful&cost effective SEO and website traffic service in world get up to 100’000 forum backlinks now! Get incredible online web traffic using best backlink blast today. We are able post your custom message up to 100’000 forums w

backlinks Jan 03 2012 at 13:39:17

Most powerful&cost effective SEO and website traffic service in world get up to 100’000 forum backlinks now! Get great web traffic using amazing backlink blast today. We are able post your marketing post up to 100’000 forums worldwide,

cash for survey Jan 10 2012 at 21:19:36

If you want to make $10-$150/hour and up to $3500/month of your free time working at home part-time then this is the most important message you’re ever going to read. Here’s why: “Businesses need M

Zokeemurelm Feb 05 2012 at 23:17:28

Hi, This just came across my desk and I had to pass it on to you ASAP… Internet multi-millionaire Mack Michaels has a few new positions available right now… If accepted you can easily rake in $11, 917 per month starti

check backlinks Feb 06 2012 at 10:23:17

aloha iphonetut.com admin found your site via search engine but it was hard to find and I see you could have more visitors because there are not so many comments yet. I have discovered site which offer to dramatically increase traffic to your blog http://


Leave your comment here






User Login




New User Forgot password

Newsletter Subscribe

Advertisement

 
 
 
quick contact