Oh wow! The voice of much pain speaking! Makes me want to cringe in the corner 
and say in a small voice "but, but, but I just wanted to add a subview, sir".

I got most of the way without having to use the geometryFlipped (using a 
transform to flip coordinates) - I had seen some of your, and others' posts 
about the issues, and tried to avoid it, but my stuff kept jumping around in my 
scroll view when I changed the bounds of it and tried to keep the viewport 
stable, and I couldn't find a way to fix that. Changing to geometryFlipped 
fixed that, but introduced these other problems.

I have encountered the issue with printing, and worked around that by walking 
the drawing code as per the advice from OmniGroup. That gave me something 
workable so long as I made sure to avoid using a lot of the layer properties 
like the corner rounding, stroke and fill etc, and some of the layer classes 
like CAShapeLayer, unless I also duplicated the drawing code so that I could 
print. I did have to move away from the tiled layer as my base layer and use a 
view which draws itself, with a transparent view over the top of it to host the 
layers (which has implications for scaling etc), and a few other design 
compromises along the way. Lots of investigating and trying different things, 
but got it working well enough overall...

I could not use a layer hosting view because of the lack of ordering 
capabilities of sibling views.

One of the big reasons for going with a layer hosting view is that it allows me 
to order overlapping sibling sublayers - something critical to my application. 
Along the way, I also needed to support this for 10.5, and there were just too 
many bugs and limitations in 10.5 to be able to use layers, so I wrote my own 
NSView replacement that allows me to treat everything the same way as layers, 
and just draws the content (overlapping in the right order) into a view. This 
works fine, except that it of course doesn't make use of hardware graphics 
acceleration, so is significantly slower than the 10.6 compatible 
implementation. Seeing as only about 14% of our customers (and falling) are 
still on Leopard, I wasn't too concerned about that, but need something better 
going forward.

I had not tried adding a text view to a non-geometryFlipped layer hosting view, 
but have now tried it, and indeed you are correct about it not showing up the 
spelling checking dots, even though it does otherwise obey the positioning I 
want it.

The whole core animation stuff does feel a bit "raw" when you really try using 
it seriously, but at the same time, very promising, and heading in some nice 
directions. I expect Apple will be doing some serious work on it for Lion, and 
am expecting it to really shine there...but that really doesn't help me for now.

I respect both your opinion and David's and might try David's suggested 
solution today, even though it does appear to require overlapping sibling 
views, which I have found can not be guaranteed what order they will appear in. 
The other option I am considering is just using a child window as an overlay 
and doing all my view stuff in there. I'll need to think it through, but it may 
well work well enough for my needs if I clip to my scroll view's clip view size 
and reposition things on the child window when the parent scrolls.

I really don't want to completely throw out the CA implementation when I am so 
close, and have overcome all the other issues I have encountered and got the 
core system working so nicely for just about everything else.

Thanks for taking the time to reply with all the feedback and suggestions. Time 
for me to try some more things out...

Regards

Gideon

On 17/12/2010, at 5:09 AM, Kyle Sluder wrote:

> 
> Ohhh, boy. :)
> 
> 
[much stuff removed]

> My professional suggestion: avoid using Core Animation for anything
> related to traditional UI. CA is great for things like Front Row,
> sprite-based animation/games, overlays atop Core Video movie playback,
> data visualization (but be careful here! sometimes it's also the wrong
> tool for building data visualization)... it's not good for writing the
> next version of your productivity app's main content view.
> 
> --Kyle Sluder

_______________________________________________

Cocoa-dev mailing list ([email protected])

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 [email protected]

Reply via email to