首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >FScalendar定制

FScalendar定制
EN

Stack Overflow用户
提问于 2020-03-04 13:47:26
回答 2查看 2K关注 0票数 0

我是编程新手,我正在使用FScalendar,我想将日期名称更改为两个字母表,即(SU,MO,TU.....),并且我想删除单元格之间的间隙?

我已经在给定的区域尝试过了,但没有找到解决方案:

@property (weak, nonatomic) FSCalendarAppearance *appearance;

我附上的图片供参考,其中的差距是清晰可见的。

enter image description here

是否需要更改此代码以获得单元格之间的零间隙?

代码语言:javascript
复制
// 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

EN

回答 2

Stack Overflow用户

发布于 2020-03-04 14:47:21

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

2-

3-

代码语言:javascript
复制
let week_days_view = weekDaysView.instanceFromNib() as! weekDaysView
    week_days_view.frame = self.fsCalendar.calendarWeekdayView.frame
    self.fsCalendar.calendarWeekdayView.addSubview(week_days_view)
票数 0
EN

Stack Overflow用户

发布于 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 libraryIn Swift check here

代码语言:javascript
复制
NSString * str = [weekdaySymbols[index] uppercaseString];
label.text = [str substringToIndex:2];

关于这个I want to remove the gaps between cells?,像下面这样试试,是的,你需要试试这个@property (weak, nonatomic) FSCalendarAppearance *appearance;

代码语言:javascript
复制
    calendar.appearance.titleOffset = CGPoint.init(x: -50, y: 0.0)
    calendar.appearance.eventOffset = CGPoint.init(x: -50, y: 0.0)
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/60519770

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档