我是编程新手,我正在使用FScalendar,我想将日期名称更改为两个字母表,即(SU,MO,TU.....),并且我想删除单元格之间的间隙?
我已经在给定的区域尝试过了,但没有找到解决方案:
@property (weak, nonatomic) FSCalendarAppearance *appearance;
我附上的图片供参考,其中的差距是清晰可见的。
是否需要更改此代码以获得单元格之间的零间隙?
// Calculate item widths and lefts
free(self.widths);
self.widths = ({
NSInteger columnCount = 7;
size_t columnSize = sizeof(CGFloat)*columnCount;
CGFloat *widths = malloc(columnSize);
CGFloat contentWidth = self.collectionView.fs_width - self.sectionInsets.left - self.sectionInsets.right;
FSCalendarSliceCake(contentWidth, columnCount, widths);
widths;
});
free(self.lefts);
self.lefts = ({
NSInteger columnCount = 7;
size_t columnSize = sizeof(CGFloat)*columnCount;
CGFloat *lefts = malloc(columnSize);
lefts[0] = self.sectionInsets.left;
for (int i = 1; i < columnCount; i++) {
lefts[i] = lefts[i-1] + self.widths[i-1];
}
lefts;
});
// Calculate item heights and tops
free(self.heights);
self.heights = ({
NSInteger rowCount = self.calendar.transitionCoordinator.representingScope == FSCalendarScopeWeek ? 1 : 6;
size_t rowSize = sizeof(CGFloat)*rowCount;
CGFloat *heights = malloc(rowSize);
if (!self.calendar.floatingMode) {
CGFloat contentHeight = self.collectionView.fs_height - self.sectionInsets.top - self.sectionInsets.bottom;
FSCalendarSliceCake(contentHeight, rowCount, heights);
} else {
for (int i = 0; i < rowCount; i++) {
heights[i] = self.estimatedItemSize.height;
}
}
heights;
});
free(self.tops);
self.tops = ({
NSInteger rowCount = self.calendar.transitionCoordinator.representingScope == FSCalendarScopeWeek ? 1 : 6;
size_t rowSize = sizeof(CGFloat)*rowCount;
CGFloat *tops = malloc(rowSize);
tops[0] = self.sectionInsets.top;
for (int i = 1; i < rowCount; i++) {
tops[i] = tops[i-1] + self.heights[i-1];
}
tops;
});源文件->。FSCalendarCollectionViewLayout.m
发布于 2020-03-04 14:47:21

您可以通过在weekDays的fscalendar中添加一个子视图来完成此操作。我添加了单个字母,但您可以根据需要添加。1-创建视图

2-

3-
let week_days_view = weekDaysView.instanceFromNib() as! weekDaysView
week_days_view.frame = self.fsCalendar.calendarWeekdayView.frame
self.fsCalendar.calendarWeekdayView.addSubview(week_days_view)发布于 2020-03-04 14:56:16
@ABTech关于这个I want to change days name into two alphabets i.e. (SU,MO,TU.....),尝试修改FSCalendarWeekdayView.m file on it's - (void)configureAppearance method on FSCalendar library。In Swift check here
NSString * str = [weekdaySymbols[index] uppercaseString];
label.text = [str substringToIndex:2];关于这个I want to remove the gaps between cells?,像下面这样试试,是的,你需要试试这个@property (weak, nonatomic) FSCalendarAppearance *appearance;
calendar.appearance.titleOffset = CGPoint.init(x: -50, y: 0.0)
calendar.appearance.eventOffset = CGPoint.init(x: -50, y: 0.0)https://stackoverflow.com/questions/60519770
复制相似问题