iOS自定义控件及相关工作新学知识日历-FSCalendar

FSCalendar使用介绍(三) - 订制外观

2016-07-03  本文已影响15992人  WenchaoD

FSCalendar具有高度的可定制性:

外观分类

<a id='text_color'></a>文字颜色

<a id='font'></a>字体

单元格中的字体大小默认是自适应的,需要先关闭自适应。否则字体尺寸不会发生改变

calendar.appearance.adjustsFontSizeToFitContentSize = NO; // 关闭文字尺寸自适应

<a id='common_color'></a>背景、边框、事件圆点

<a id='other'></a>其他属性

// 1.0=圆,0.0=正方形,0.0-1.0之间的值为圆角
@property (assign, nonatomic) CGFloat borderRadius;

**例: **

calendar.appearance.borderRadius = 0; // 设置正方形单元格

或实现FSCalendarDelegateAppearance-calendar:appearance:borderRadiusForDate:方法

效果:

@property (assign, nonatomic) FSCalendarCaseOptions caseOptions;

// 定义
typedef NS_OPTIONS(NSUInteger, FSCalendarCaseOptions) {
    // 月文字
    FSCalendarCaseOptionsHeaderUsesDefaultCase      = 0, // June 2016
    FSCalendarCaseOptionsHeaderUsesUpperCase        = 1, // JUNE 2016
    
    // 周文字
    FSCalendarCaseOptionsWeekdayUsesDefaultCase     = 0 << 4, // Sun、Mon、Tue、Wed、Thu、Fri、Sat; 周日、周一、周二、周三、周四、周五、周六
    FSCalendarCaseOptionsWeekdayUsesUpperCase       = 1 << 4, // SUN、MON、TUE、WED、THU、FRI、SAT; 周日、周一、周二、周三、周四、周五、周六
    FSCalendarCaseOptionsWeekdayUsesSingleUpperCase = 2 << 4, // S、M、T、W、T、F、S; 日、一、二、三、四、五、六
};

例:

calendar.appearance.caseOptions = FSCalendarCaseOptionsHeaderUsesUpperCase | FSCalendarCaseOptionsWeekdayUsesUpperCase;

效果:

@property (strong, nonatomic) NSString *headerDateFormat;

代表显示的月份格式。

例:

calendar.appearance.headerDateFormat = @"yyyy年MM月";

效果:

/**
 * The alpha value of month label staying on the fringes.
 */
@property (assign, nonatomic) CGFloat  headerMinimumDissolvedAlpha;

这个属性控制‘上个月’和‘下个月’标签在静止时刻的透明度。

例:

calendar.appearance.headerMinimumDissolvedAlpha = 0;

效果:

项目主页: https://github.com/WenchaoD/FSCalendar

QQ支持群: 323861692
上一篇下一篇

猜你喜欢

热点阅读