iOS 時鐘:SPClockView
SPClockView 特性如下:
-
可以設置時區,也可以從列表中選擇時區
-
自動檢測日間和夜間,轉換時鐘的背景
-
不能用
NSTimer
來規劃時間,不能使用任意的 UI 操作 -
點擊來添加和刪除時鐘
-
顯示時區的名字和數碼格式的時間
-
數碼時鐘來顯示的格式:
HH:mm:ss
如何使用
- Import the files
SPClockView.h
andSPClockView.m
into your projects. - After adding the
SPClockView
into your parent view, set itstime zone
by callingsetTimeZone:
method. - Digital clock
SPDigitalClock
is a subclass ofUILabel
, and is implemented inside theSPClockView
class. To set the digital time also call the methodsetTimeZone:
onSPDigitalClock
示例:
-
SPClockView
SPClockView *clockView = [[SPClockView alloc] initWithFrame:CGRectMake(0, 0, 140, 140)]; [clockView setTimeZone:[NSTimeZone timeZoneWithAbbreviation:@"EDT"]]; // New York
-
SPDigitalClock
SPDigitalClock *digClock = [[SPDigitalClock alloc] initWithFrame:CGRectMake(0, 0, 140, 140)]; [digClock setTimeZone:[NSTimeZone timeZoneWithAbbreviation:@"EDT"]]; // New York
本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!