2013-06-25 1 views
1

아래에 Tapku 달력 및 테이블보기가 있습니다. 캘린더에는 일정한 높이가 없으며 여러 달 동안 다른 행의 수에 따라 달라집니다. 몇 달 동안 5 행이 있고 6 행 정도 있습니다. 달력이 끝나는 곳에서 시작해야하는 테이블 프레임을 설정하고 싶습니다. 아래에 언급 된 방법을 시도했지만 작동하지 않습니다.Tapku 달력 높이에 따라 UITableView 프레임을 설정하십시오.

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

    [self.mTableView setFrame:CGRectMake(0, calendar.frame.origin.y + calendar.frame.size.height, 320, 308 - calendar.frame.size.height - calendar.frame.origin.y)]; 
    [self.mTableView reloadData]; 

NSLog(@"calendar height:%f", calendar.frame.size.height); 
} 

콘솔의 인쇄 높이 : 0.000000입니다. 위 안내를 참조하십시오.

답변

1

이 여전히 관련이있는 경우, UI에서 TapkuLibrary에서 TKCalendarMonthTableViewController.m 파일에서 이것을 시도> 캘린더> 월, 그것은, 당신과 똑같은 문제를 가지고 나를 위해 일한 :

- (void)calendarMonthView:(TKCalendarMonthView *)monthView monthDidChange:(NSDate *)month animated:(BOOL)animated { 
    [self updateTableOffset:animated]; 
} 

- (void) updateTableOffset:(BOOL)animated{ 

    if(animated){ 
     [UIView beginAnimations:nil context:nil]; 
     [UIView setAnimationDuration:0.4]; 
     [UIView setAnimationDelay:0.1]; 
    } 


    float y = self.monthView.frame.origin.y + self.monthView.frame.size.height; 
    self.tableView.frame = CGRectMake(self.tableView.frame.origin.x, y, self.tableView.frame.size.width, self.view.frame.size.height - y); 
    if(animated) [UIView commitAnimations]; 
} 

처음부터 높이를 조정하려면에는 loadView에, 난 그냥 달력을 초기화 한 후 날짜를 선택 :

calendar = [[TKCalendarMonthView alloc] initWithSundayAsFirst:NO]; 
[calendar selectDate:[NSDate date]]; 

프레임은 monthDidChange 후 조정되지 않습니다 그런 식으로 ..

도움이되기를 바랍니다!

관련 문제