先看效果图

IOS4.0 实例练习时钟

思路:

1. Timer
2. Label

练习

IOS 中 Timer是NS开头,新增 TestTimer的Project,自动生成
IOS4.0 实例练习时钟
在TestTimerAppDelegate.h添加如下

IOS4.0 实例练习时钟

在TestTimerAppDelegate.m 实现onTimer,同时需要在applicationdidFinishLaunchingWithOptions实例化NSTimer

IOS4.0 实例练习时钟
所有实例化的东西需要dealloc

IOS4.0 实例练习时钟

TestTimerViewController.h如下

IOS4.0 实例练习时钟

countdownLabel为 View 中输出的UILable的名称

在TestTimerViewController.m

IOS4.0 实例练习时钟
实现updateLabel

效果图如上

相关文章:

  • 2021-07-16
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-01
  • 2021-11-12
  • 2021-06-21
  • 2022-02-20
猜你喜欢
  • 2021-09-04
  • 2022-12-23
  • 2022-01-18
  • 2021-09-26
  • 2021-07-18
  • 2021-09-16
  • 2021-12-12
相关资源
相似解决方案