IOS4.0 实例练习时钟
先看效果图
思路:
1. Timer
2. Label
练习
IOS 中 Timer是NS开头,新增 TestTimer的Project,自动生成
在TestTimerAppDelegate.h添加如下
在TestTimerAppDelegate.m 实现onTimer,同时需要在applicationdidFinishLaunchingWithOptions实例化NSTimer
所有实例化的东西需要dealloc
在
TestTimerViewController.h如下
countdownLabel为 View 中输出的UILable的名称
在TestTimerViewController.m
实现updateLabel
效果图如上