Responding to myself, as I promised. I have found a fatal problem with
my approach on Leopard. The layers begin to appear in weird places,
sometimes they disappear at all. As it turns out, -setPosition: is
called with wrong values (probably assuming a different anchorPoint)
and -setBounds: is called with negative height and negative origin.y.
I tried to fix this by also overriding -setPosition: and -setBounds:,
but the problems seem to only spawn more, because the system seem to
internally assume certain values of bounds, anchorPoint, position etc.
after it sets them, so that when they appear to be different because
of the overriden setters, the effect can be a total mess.

I feel I have to abandon the idea of flipping layer geometry
altogether, because if it even doesn't work on Leopard, then the very
purpose of the thing is defeated. If I could drop support of Leopard,
I could use the geometryFlipped without any problem.

I feel very upset that there is no easy way to use the top-left-origin
coordinate system in Core Animation on Leopard. It's beyond my
understanding how it could escape from the creators of Core Animation,
that having the origin in the top left corner is the most natural
thing for computer screens. All scrolling, text flow etc. always start
from the top, not from the bottom. I always find myself fighting with
"flipped" coordinate systems and I have never encountered a single
case when having the origin at the bottom would be helpful. Sigh :(



On Fri, Jul 16, 2010 at 11:48 AM, Oleg Krupnov <oleg.krup...@gmail.com> wrote:
> Further investigation has shown that when the custom layer-hosting
> view is placed in the parent layer-backed container view, the parent
> view internally discards the flipping transform of the child view's
> root layer on each call to its -setFrame (which can be quite often).
>
> I have cured this problem by subclassing CALayer of the root layer of
> the custom layer-hosting view and overriding its following methods:
>
> - (void)setTransform:(CATransform3D)m
> {
>        CATransform3D flipTransform = CATransform3DIdentity;
>        flipTransform.m22 = -1.0;
>        [super setTransform:flipTransform];
> }
>
> - (void)setAnchorPoint:(CGPoint)point
> {
>        [super setAnchorPoint:CGPointMake(0.0, 1.0)];
> }
>
> This seems to work pretty well so far. If I come up with any problem,
> I'll post it here.
>
> And also it doesn't seem like a bad hack (unlike calling private
> methods). What do you think?
>
>
> Thanks,
>
> On Fri, Jul 16, 2010 at 7:01 AM, Scott Anguish <sc...@cocoadoc.com> wrote:
>>
>> On Jul 15, 2010, at 1:24 PM, Kyle Sluder wrote:
>>
>>> On Thu, Jul 15, 2010 at 9:18 AM, Oleg Krupnov <oleg.krup...@gmail.com> 
>>> wrote:
>>>> Is this a bug? And how to work around it?
>>>
>>> There are lots of bugs with flipped layer-hosting views inside of
>>> layer-backed views.. See this thread:
>>> http://lists.apple.com/archives/cocoa-dev/2010/May/msg00988.html
>>>
>>> The only workaround I was able to get working was to call a private
>>> AppKit method to fix up the layer geometry.
>>>
>>
>> Which is a no-no, and shouldn’t be done. Bad Kyle. No biscuit.
>>
>>
>
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to