iOS 時鐘:SPClockView
SPClockView 特性如下:
-
可以設置時區,也可以從列表中選擇時區
-
自動檢測日間和夜間,轉換時鐘的背景
-
不能用
NSTimer來規劃時間,不能使用任意的 UI 操作 -
點擊來添加和刪除時鐘
-
顯示時區的名字和數碼格式的時間
-
數碼時鐘來顯示的格式:
HH:mm:ss
如何使用
- Import the files
SPClockView.handSPClockView.minto your projects. - After adding the
SPClockViewinto your parent view, set itstime zoneby callingsetTimeZone:method. - Digital clock
SPDigitalClockis a subclass ofUILabel, and is implemented inside theSPClockViewclass. To set the digital time also call the methodsetTimeZone:onSPDigitalClock
示例:
-
SPClockViewSPClockView *clockView = [[SPClockView alloc] initWithFrame:CGRectMake(0, 0, 140, 140)]; [clockView setTimeZone:[NSTimeZone timeZoneWithAbbreviation:@"EDT"]]; // New York
-
SPDigitalClockSPDigitalClock *digClock = [[SPDigitalClock alloc] initWithFrame:CGRectMake(0, 0, 140, 140)]; [digClock setTimeZone:[NSTimeZone timeZoneWithAbbreviation:@"EDT"]]; // New York

本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!