日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

[翻译] JTCalendar

發(fā)布時(shí)間:2025/7/14 编程问答 19 豆豆
生活随笔 收集整理的這篇文章主要介紹了 [翻译] JTCalendar 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

JTCalendar

?

JTCalendar is a calendar control for iOS easily customizable.

JTCalendar 是一個(gè)很容易定制的日歷的控件。

?

Usage

Basic usage - 基本使用方法

You have to create two views in your UIViewController.

你需要在你的UIViewController創(chuàng)建出兩個(gè)view。

The first view is?JTCalendarMenuView, it represents the months.

第一個(gè)view是JTCalendarMenuView,他代表著月份。

The second view is?JTCalendarContentView, the calendar itself.

第二個(gè)view是JTCalendarContentView,這個(gè)是日歷本身。

Your UIViewController must implement?JTCalendarDataSource

你的UIViewController 必須實(shí)現(xiàn)JTCalendarDataSource代理。

#import <UIKit/UIKit.h>#import "JTCalendar.h" @interface ViewController : UIViewController<JTCalendarDataSource> @property (weak, nonatomic) IBOutlet JTCalendarMenuView *calendarMenuView; @property (weak, nonatomic) IBOutlet JTCalendarContentView *calendarContentView; @property (strong, nonatomic) JTCalendar *calendar; @end

JTCalendar?is used to coordinate?calendarMenuView?and?calendarContentView.

JTCalendar?是用來定位calendarMenuView與?calendarContentView的。

@implementation ViewController- (void)viewDidLoad {[super viewDidLoad];self.calendar = [JTCalendar new]; [self.calendar setMenuMonthsView:self.calendarMenuView]; [self.calendar setContentView:self.calendarContentView]; [self.calendar setDataSource:self]; } - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; [self.calendar reloadData]; // Must be call in viewDidAppear } - (BOOL)calendarHaveEvent:(JTCalendar *)calendar date:(NSDate *)date { return NO; } - (void)calendarDidDateSelected:(JTCalendar *)calendar date:(NSDate *)date { NSLog(@"%@", date); } @end

?

Switch to week view

切換到week

If you want see just one week at time you can switch when you want between the weekMode.

如果你只想看一周的時(shí)間,你可以切換到weekMode模式

self.calendar.calendarAppearance.isWeekMode = YES; [self.calendar reloadAppearance];

?

WARNING

注意

When you change the mode, it doesn't change the height of?calendarContentView, you have to do it yourself. See the project in example for more details.

當(dāng)你切換樣式時(shí),他并沒有改變calendarContentView的高度,你需要自己手動(dòng)設(shè)置。你可以在項(xiàng)目中找到實(shí)現(xiàn)細(xì)節(jié)。

?

Customize the design

自定義設(shè)計(jì)

You have a lot of options available for personnalize the design. Check the?JTCalendarAppearance.h?file for see all options.

你有這很多很多的選項(xiàng)來定制設(shè)計(jì)。你可以再JTCalendarAppearance.h文件中找到這些配置選項(xiàng)。

self.calendar.calendarAppearance.calendar.firstWeekday = 2; // Monday self.calendar.calendarAppearance.ratioContentMenu = 1.; self.calendar.calendarAppearance.menuMonthTextColor = [UIColor whiteColor]; self.calendar.calendarAppearance.dayCircleColorSelected = [UIColor blueColor]; self.calendar.calendarAppearance.dayTextColorSelected = [UIColor whiteColor]; [self.calendar reloadAppearance];

?

Recommendation

推薦用法

The call to?reloadAppearance?is expensive,?reloadAppearance?is call by?setMenuMonthsView?andsetContentView.

調(diào)用reloadAppearance?開銷很大,setMenuMonthsView?與andsetContentView會(huì)調(diào)用reloadAppearance?方法

For better performance define the appearance just after instanciate?JTCalendar.

BAD example:

self.calendar = [JTCalendar new];[self.calendar setMenuMonthsView:self.calendarMenuView]; [self.calendar setContentView:self.calendarContentView]; [self.calendar setDataSource:self]; self.calendar.calendarAppearance.calendar.firstWeekday = 2; // Monday self.calendar.calendarAppearance.ratioContentMenu = 1.; self.calendar.calendarAppearance.menuMonthTextColor = [UIColor whiteColor]; self.calendar.calendarAppearance.dayCircleColorSelected = [UIColor blueColor]; self.calendar.calendarAppearance.dayTextColorSelected = [UIColor whiteColor]; [self.calendar reloadAppearance]; // You have to call reloadAppearance

GOOD example:

self.calendar = [JTCalendar new];self.calendar.calendarAppearance.calendar.firstWeekday = 2; // Monday self.calendar.calendarAppearance.ratioContentMenu = 1.; self.calendar.calendarAppearance.menuMonthTextColor = [UIColor whiteColor]; self.calendar.calendarAppearance.dayCircleColorSelected = [UIColor blueColor]; self.calendar.calendarAppearance.dayTextColorSelected = [UIColor whiteColor]; [self.calendar setMenuMonthsView:self.calendarMenuView]; [self.calendar setContentView:self.calendarContentView]; [self.calendar setDataSource:self]; // You don't have to call reloadAppearance

You may also want to open your calendar on a specific date, by defaut it's?[NSDate date].

你也許想在打開日歷的時(shí)候定位到指定的日期,默認(rèn)值是[NSDate date]

[self.calendar setCurrentDate:myDate];

Requirements

  • iOS 7 or higher
  • Automatic Reference Counting (ARC)

?

轉(zhuǎn)載于:https://www.cnblogs.com/YouXianMing/p/4093660.html

《新程序員》:云原生和全面數(shù)字化實(shí)踐50位技術(shù)專家共同創(chuàng)作,文字、視頻、音頻交互閱讀

總結(jié)

以上是生活随笔為你收集整理的[翻译] JTCalendar的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。