本文介绍了iOS:使Tapku日历库瓷砖网格大小总是6x6的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到,Tapku日历网格的大小在5x5和6x6之间,具体取决于月份的日期分布。例如,它显示2012年3月的5x5网格,并显示6x6网格为2012年9月!对我来说,它使GUI对齐出错,我想要网格始终是6x6。我一直在调查TKCalenderMonthView的rangeOfDatesInMonthGrid方法,但没有得到它如何创建网格!任何人都可以告诉我如何固定网格6x6总是。

I noticed that Tapku calendar grid resized between 5x5 and 6x6 depending on the month's dates distribution. For example it displays 5x5 grid for March 2012 and displays 6x6 grid for September 2012! For me it makes GUI alignments go wrong so I want grid to be always 6x6. I have been looking into TKCalenderMonthView's rangeOfDatesInMonthGrid method but not getting how it creates the grid! Could anyone please tell me how to fix the grid 6x6 always.

感谢。

推荐答案

在选择和删除标记上显示标记,然后使用以下代码(不显示蓝色标记)

Solution to 2nd Point.If you want to display a mark on selected and remove mark from deselected dates then use follwoing code.(It wont display blue mark)

- (void)calendarMonthView:(TKCalendarMonthView *)monthView didSelectDate:(NSDate *)d {
NSLog(@"calendarMonthView didSelectDate");

NSDateFormatter *df=[[NSDateFormatter alloc] init];
[df setDateFormat:@"yyyy-MM-dd"];
[df setTimeZone:[NSTimeZone systemTimeZone]];

NSString *strqw=[df stringFromDate:d];
NSLog(@"%@",strqw);
NSString *stss=[strqw stringByAppendingString:@" 00:00:00 +0000"];
NSLog(@"%@",stss);
int k=0;
for (int i=0; i<[array1 count]; i++) {
    if([[array1 objectAtIndex:i]isEqualToString:stss]){
         [array1 removeObjectAtIndex:i];
        k=1;
    }
}
if(k==0)
[array1 addObject:stss];

[calendar reload];
}

并添加此行

NSArray * data = [[NSArray alloc] initWithArray:array1];


在下面的方法中

And add this line
NSArray *data=[[NSArray alloc] initWithArray:array1];in the below method

 - (NSArray*)calendarMonthView:(TKCalendarMonthView *)monthView marksFromDate:(NSDate *)startDate toDate:(NSDate *)lastDate

这篇关于iOS:使Tapku日历库瓷砖网格大小总是6x6的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 18:21