UI Issue with kal calendar for ipad?

回眸只為那壹抹淺笑 提交于 2020-01-30 14:56:12

问题


I have UI issue with Kal Calendar for iPad. On the iPad there is an empty space but on the iPhone it's fine. How can i get it to fit in the frame on the iPad?

if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
{
    [kal.view setFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
}
else if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
{
    [kal.view setFrame:CGRectMake(0, 0,768 ,1004)];

}

I tried to use the code listed above but it did not work for me!


回答1:


in KalGridView.m you'll find this.

const CGSize kTileSize = { 46.f, 44.f };

I'd change the code to a property where you can set the frame dynamically to the idiom and/or orientation.

in KalGridView.m

 const CGSize kTileSize = { 109.0f, 109.0f };

and in KalView.m

- (void)addSubviewsToHeaderView:(UIView *)headerView

  …

  for (CGFloat xOffset = 0.f; xOffset < headerView.width; xOffset += 109.f, i = (i+1)%7) {
    CGRect weekdayFrame = CGRectMake(xOffset, 30.f, 109.f, kHeaderHeight - 29.f);
    UILabel *weekdayLabel = [[UILabel alloc] initWithFrame:weekdayFrame];
    weekdayLabel.backgroundColor = [UIColor clearColor];
    weekdayLabel.font = [UIFont boldSystemFontOfSize:10.f];
    weekdayLabel.textAlignment = UITextAlignmentCenter;
    weekdayLabel.textColor = [UIColor colorWithRed:0.3f green:0.3f blue:0.3f alpha:1.f];
    weekdayLabel.shadowColor = [UIColor whiteColor];
    weekdayLabel.shadowOffset = CGSizeMake(0.f, 1.f);
    weekdayLabel.text = [weekdayNames objectAtIndex:i];
    [headerView addSubview:weekdayLabel];
    [weekdayLabel release];
  }
}

results in:



来源:https://stackoverflow.com/questions/8835373/ui-issue-with-kal-calendar-for-ipad

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!