1

I'm using Kal calendar, which is open source. The issue here is dates are not rendering properly with iOS 10. Please let me know if you have solution or what is causing the issue.

screenshot: https://github.com/klazuka/Kal/issues/106

Thanks

selva
  • 799
  • 2
  • 13
  • 25

3 Answers3

2

Seems to be an issue with the system font name. I replaced
UIFont *font = [UIFont boldSystemFontOfSize:fontSize];
with
UIFont *font = [UIFont fontWithName:@"Helvetica" size:fontSize];
in KalTileView to get it working.

David
  • 46
  • 1
  • 3
  • Thanks David.. Your solution works fine. In the same KalTileView there are deprecated methods CGContextSelectFont and CGContextShowTextAtPoint. So, I was trying to replace the deprecated methods with "NSFontAttributeName". I could see the dates after changing the methods but the date(number) is reversed upside down. Xcode is not showing "boldSystemFontOfSize" as deprecated. – selva Sep 14 '16 at 17:05
  • This also works fine, which is alternate to the deprecated methods. [dayText drawAtPoint:CGPointMake(textX, textY) withAttributes:@{NSFontAttributeName:[UIFont fontWithName:@"Helvetica" size:17]}]; – selva Sep 14 '16 at 17:22
  • @selva I'd also like to replace the deprecated methods but the drawAtPoint is not placing the day numbers correctly for me. They are infringing up on the day markers. Indeed I didn't meant to indicate boldSystemFontOfSize was deprecated, only that replacing it solved my issue. – David Sep 14 '16 at 18:07
1

To David: Thanks for your solution as well.

To Selva: I tried to replace CGContextShowTextAtPoint by drawAtPoint and also got upside down problem. Then i add below to fix this, hope this helps

  CGContextSaveGState(ctx);
  CGContextTranslateCTM(ctx, 0.0f, self.bounds.size.height);
  CGContextScaleCTM(ctx, 1.0f, -1.0f);

  [YourTextString drawAtPoint:CGPointMake(X, Y) withAttributes:@{NSFontAttributeName:font}];

  CGContextRestoreGState(ctx);
Barry Tji
  • 11
  • 1
0

system font not working.Try to use below code.

UIFont *font = [UIFont fontWithName:@"Helvetica" size:fontSize]; in KalTileView to get it working.