欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

iOS實現(xiàn)一個簡易日歷代碼

 更新時間:2017年03月29日 15:25:46   作者:Kegem  
本篇文章主要介紹了iOS實現(xiàn)一個簡易日歷代碼,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧

日歷一般都是用UICollectionView進(jìn)行開發(fā)的,相關(guān)demo也很多,這里就講一個我最近寫的玩的demo,由于時間原因沒來得及加年歷和周歷,一個月歷的小demo,隨著月份天數(shù)的不同,自動改變?nèi)諝v的高。

代理部分:

@protocol KJCalendarDelegate <NSObject>

/**
 隨著每個月的天數(shù)不一樣而改變高度

 @param height 日歷高度
 */
- (void)calendarViewHeightChange:(CGFloat)height;


/**
 當(dāng)前展示的年和月,當(dāng)類型是年歷的時候,只返回年

 @param year 年
 @param month 月
 */
- (void)currentShowYear:(NSInteger)year withMonth:(NSInteger)month;


/**
 選中的時間

 @param solar 陽歷
 @param lunar 農(nóng)歷
 */
- (void)selectSolarDate:(NSString *)solar withLunar:(NSString *)lunar;

@end

這個當(dāng)時創(chuàng)建文件的時候,沒注意,KJCalendar寫成了KJCanlendar,抱歉。。。

下面是可自定義的部分:

//======以下屬性可自定義======

//背景顏色
@property (strong, nonatomic) UIColor *bgColor;
//weekView背景色 默認(rèn)clearcolor
@property (strong, nonatomic) UIColor *weekColor;
//選擇狀態(tài)下的背景顏色
@property (strong, nonatomic) UIColor *selectBgColor;
//選擇狀態(tài)下的字體顏色
@property (strong, nonatomic) UIColor *selectTitleColor;
//普通狀態(tài)下公歷字體顏色
@property (strong, nonatomic) UIColor *normalDateTitleColor;
//普通狀態(tài)下農(nóng)歷字體顏色
@property (strong, nonatomic) UIColor *normalLunerTitleColor;
//今天的字體顏色
@property (strong, nonatomic) UIColor *todayTitleColor;
//今天選擇狀態(tài)下的背景顏色
@property (strong, nonatomic) UIColor *todaySelectBgColor;
//今天選擇狀態(tài)下的字體顏色
@property (strong, nonatomic) UIColor *todaySelectTitleColor;
//距屏幕左右間隔,默認(rèn)8
@property (assign, nonatomic) CGFloat screenInSpace;
//每行(item)的高度,設(shè)置的高度不能大于寬度,寬度的來源是屏幕的寬減去左右間隔除以7得到
@property (assign, nonatomic) CGFloat rowHeight;
//設(shè)置是否顯示陰歷 YES-顯示 NO-隱藏 默認(rèn)YES
@property (assign, nonatomic) BOOL isShowLunar;
//公歷字體 默認(rèn)system 13
@property (strong, nonatomic) UIFont *dateFont;
//農(nóng)歷字體 默認(rèn)system 8
@property (strong, nonatomic) UIFont *lunerFont;
//選中時公歷字體 默認(rèn) [UIFont boldSystemFontOfSize:13.0f];
@property (strong, nonatomic) UIFont *dateSelectFont;
//選中時農(nóng)歷字體 默認(rèn) [UIFont boldSystemFontOfSize:8.0f];
@property (strong, nonatomic) UIFont *lunerSelectFont;

使用也很簡單:

//高度是根據(jù)日歷的月份天數(shù)決定的
  self.calView = [[KJCanlendarView alloc] initWithY:0 withNavc:YES andLeastYear:0];
  self.calView.kjDelegate = self;

  [self.calView showKJCalendarInCtrl:self];

每個屬性都有默認(rèn)值,需要改變賦值即可,當(dāng)然啦,設(shè)置字體時,要調(diào)整背景圓圈的大小以及rouHeight的大小,具體的下面我給出demo,就不多說了,大家就隨便看看,寫的很隨意,希望能幫到大家。

demo:KJCalendar_jb51.rar

效果圖:

以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

最新評論