Closed groue closed 7 years ago
Awesome! I merged your changes with my fork.
It also has a KalImageManager class from this fork and I refactored to modern Obj-c and ARC.
In your example code you have a number of enum 'State' values. Those aren't defined anywhere. I'm just getting in to the UIApearence API, so this might be a simple thing... But, I don't see where the Kal code would use these values. Have you committed all your code? It there more to come?
Thanks. -Brian
Ooooops. My fail. I'm still getting used to GitHub. I didn't have all the work you did. I'm merging it now.
I'm going to go in and try to fix the bugs, but the current commits of pierlis/Kal has some problems. If you run the Holliday app and flip through a few months, you find that many days are miss numbered and treated from a previous/next month, when they are in the current month.
I'll let you all know when I have it working bug free. (If I'm misunderstanding something, let me know)
I didn't expect appearance to alter day numbering... I'm happy those commits help you !
I might have been going cross eyed yesterday, because I can't reproduce the mis-numbering... But, the appearance was definitely not working correctly. I would fork your code and submit a pull request, but I'm still learning github. I don't see how to fork the same project from 2 people and submit code back.
I tracked the bug down to this one line of code:
KalTileView.m:
- (KalTileState)state { return *(int *)(&flags); }
That isn't giving you the result you want. My code is verbose and surely a math wiz could condense it,but this replacement does work:
- (KalTileState)state
{
KalTileState currentState = KalTileStateNormal;
if (flags.selected) currentState = (currentState | KalTileStateSelected);
if (flags.highlighted) currentState = (currentState | KalTileStateHighlighted);
if (flags.marked) currentState = (currentState | KalTileStateMarked);
if (flags.type == KalTileTypeAdjacent) currentState = (currentState | KalTileStateAdjacent);
if (flags.type == KalTileTypeToday) currentState = (currentState | KalTileStateToday);
if (flags.type == (KalTileTypeAdjacent | KalTileTypeToday))
{
currentState = (currentState | KalTileStateAdjacent | KalTileStateToday);
}
//KalTileState oldWayToCalculateState = *(int *)(&flags);
//NSLog(@"KalTileState Old: %d New: %d", oldWayToCalculateState, currentState );
return currentState;
}
Hi. Thanks for your Kal library.
I had to customize the grid appearence.
This has involved changing images in Kal.bundle (uncovered by these commits), introducing a
backgroundView
property of KalGridView, and having KalTileView conform to the UIAppearanceContainer protocol.My goal was to be able to write code like:
Let me know if you're interested.