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 .
Great working
nice working dude.......
BION I'm ipmressed! Cool post!
L8PDeL vjrbqjybsgcm
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:/
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
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
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,
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
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
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://
(11) Responses to this post