我正在使用此calendar作为我的申请。
问题:如何调整此日历的框架大小。我这样做了
calendar = [[TKCalendarMonthView alloc] init];
calendar.delegate = self;
calendar.frame = CGRectMake(0, 0, 200, calendar.frame.size.height);
然而,它仍显示为宽度360
有人有任何线索如何做到这一点
答案 0 :(得分:1)
如果不对TKCalendarMonthViewController进行大量更改,您将无法更改月视图(切片)的宽度。例如, - (id)initWithSundayAsFirst方法中每个tile / day的宽度设置为46。
int i = 0;
for(NSString *s in ar){
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(46 * i, 29, 46, 15)];
[self addSubview:label];
label.text = s;
label.textAlignment = UITextAlignmentCenter;
label.shadowColor = [UIColor whiteColor];
label.shadowOffset = CGSizeMake(0, 1);
label.font = [UIFont systemFontOfSize:11];
label.backgroundColor = [UIColor clearColor];
label.textColor = [UIColor colorWithRed:59/255. green:73/255. blue:88/255. alpha:1];
i++;
}
您会注意到,在许多方法中,图像都用于单个图块的背景,因此您需要创建适合您自定义宽度的图像。例如 - (void)reactToTouch:down contains:
self.selectedImageView.image = [UIImage imageWithContentsOfFile:TKBUNDLE(@"TapkuLibrary.bundle/Images/calendar/Month Calendar Date Tile Selected.png")];