Ios 设置日历单元格的大小
我正在学习JTCalendar(版本6.1.5)的教程。当我在iPhone SE等小型手机上运行时,选择视图中圆圈的一侧会被剪掉。这是因为单元约为45x45点,但选择视图的大小为50x50点,因此太大,无法完全装入单元Ios 设置日历单元格的大小,ios,swift,xcode,jtcalendar,Ios,Swift,Xcode,Jtcalendar,我正在学习JTCalendar(版本6.1.5)的教程。当我在iPhone SE等小型手机上运行时,选择视图中圆圈的一侧会被剪掉。这是因为单元约为45x45点,但选择视图的大小为50x50点,因此太大,无法完全装入单元 如何使我的选择视图适合不同大小的日期单元格 如何获得所选视图圆的cornerRadius的正确值 我能够解决这个问题。问题是教程设置了选定视图的大小,并将其保留在该大小。我所做的是 为CellView.swift中的宽度和高度限制制作插座 在ViewContoller.swif
- 如何使我的选择视图适合不同大小的日期单元格
- 如何获得所选视图圆的
的正确值cornerRadius
CellView.swift中的宽度和高度限制制作插座
ViewContoller.swift
中,我修改了单元格选择,如下所示:
if cellState.isSelected {
var parentMinDimension = min(view.frame.width, view.frame.height)
parentMinDimension = round(parentMinDimension - 0.5)
myCustomCell.widthConstraint.constant = parentMinDimension
myCustomCell.heightConstraint.constant = parentMinDimension
myCustomCell.selectedView.layer.cornerRadius = parentMinDimension / 2
myCustomCell.selectedView.isHidden = false
} else {
myCustomCell.selectedView.isHidden = true
}