Open silvermana opened 12 years ago
Set the project's base SDK to 10.7 for now to avoid some of this for now unless you can find an elegant way to fix it. I've looked into a bit and it seems like every time I feel like I've almost nailed it down, I find another case that's breaks it. Very irritating.
Yeah, I'm just worried Apple might drop a release date on 10.8 next week. If you want to share what changes you are making in a public branch I'm happy to help you test things.
I think I fixed it on my fork. The only problem I was having was that the text layer seemed flipped. I solved it by adding
//deal with 10.8 geometry differences.
self.geometryFlipped = [[[[containerView window].screen UIKitView] layer] isGeometryFlipped];
to UITextLayer.m
- (void)addNSView
I can confirm that sergio's solution works for me as well.
The patch by @sergiosilva seems to lead to UIText{View,Field}s displaying flipped for Lion users. It does seem to fix things for 10.8 users, though.
I did note that using a placeholder text in a UITextField still looked flipped for Lion users, but it was the only case, entering new text was rendered correctly, do you have others?
On 27/02/2013, at 21:45, "Jeremy W. Sherman" notifications@github.com wrote:
The patch by @sergiosilva seems to lead to UIText{View,Field}s displaying flipped for Lion users. It does seem to fix things for 10.8 users, though.
— Reply to this email directly or view it on GitHub.
Yes, I was watching live text input go in flipped. It was very strange. My current approach is just "punt and test for something new on OS X 10.8". Looks like NSColor now has colorWithCGColor:, and NSPageController is wholly new, so testing for those should let me know whether we're getting the 10.8 weirdness or the 10.7 weirdness.
Think your are missing this patch also on my fork: https://github.com/sergiosilva/Chameleon/commit/af1529fbb689bed28657678e0959d0a5ba1af344
With this only the placeholder text should still be flipped. Never investigated that case properly... Let me know if this helps.
Ah yes, I just had the code you inlined earlier. But version-sniffing turns out to work fine, and no flipping. Here's what I ended up adding to -[UITextLayer addNSView]
:
/* OS X 10.8 changes something about layer geometry.
* This fixes text drawing problems in UITextField/View on OS X.
* See <URL:https://github.com/BigZaphod/Chameleon/issues/85>.
*
* But doing this seems to flip the text for 10.7 and previous.
* So we version sniff. */
if ([NSColor respondsToSelector:@selector(colorWithCGColor:)]
&& NSClassFromString(@"NSPageController") != Nil) {
UIKitView *hostView = [[containerView window].screen UIKitView];
self.geometryFlipped = [[hostView layer] isGeometryFlipped];
}
Actually, I think that I also had some issue with some UILabels that required the patch I posted. But hey, if it works for you with just that patch to UITextLayer great! I was going to ask if your patch worked also with placeholder text but now that I think about it, support for placeholder text in UITextFields is not on the master repo so its an issue you won't run into...
If anyone is having troubles with building against the OS X 10.8 SDK, I have put several commits in my fork of the project at https://github.com/michaelmelanson/Chameleon/tree/master which fix the issues we encountered getting our application to work.
Has anyone tested their Chameleon apps on 10.8? I have and UITextFields and UITextViews are not working correctly.
If I build the app with the latest 10.7 SDK and run it on 10.8:
If I build the app with the latest 10.8 SDK and run it on 10.8:
Reading the 10.8 release notes from Apple makes me think the changes they made to NSView/CALayer is messing with Chameleon. Before I investigate for hours I wanted to see if anyone else had a solution already.