core animation messing things up!!!

Discussion in 'Mac Programming' started by liptonlover, Jun 30, 2008.

  1. liptonlover macrumors 6502a

    Mar 13, 2008
    I just recently started learning about core animation and am doing good so far, though actual tutorials are hard to find unlike cool examples that I don't understand a word of :mad:
    Anyways, I decided after getting it down pat to put simple core animation into an app I already have out. I set everything up with actions and outlets and layers being backed up so that each of the windows in the app will fade in and out when opened and closed. This works fine, I've tested it thoroughly, but it's causing a weird glitch. In each window I have a "close" button, and an "add" button among other things. Every window except for the starting window gets this weird problem where one of those buttons disappears. It's still there, you can click on it, but it becomes invisible. I've tried setting up personal outlets to those buttons to set them back to visible but that doesn't work. I've tried giving them a special layer on top of their being a sublayer and setting transparency to 1.0 but that doesn't work. I've tried moving and resizing them just in case but that didn't help. Can anyone help?

    oh I just found out resizing the window makes them appear.
  2. liptonlover thread starter macrumors 6502a

    Mar 13, 2008
  3. lucasgladding macrumors 6502

    Feb 16, 2007
    Waterloo, Ontario
    Are you using any custom view classes in the view hiererchy? If you are drawing anything with drawRect, things may begin working differently once the view is layer-backed. Furthermore, there are size restrictions with CALayer textures that could be causing the issue. I experienced a similar issue and was able to resolve it by explicitly creating a CAScrollLayer and assigning it as the backing layer for the top view requiring a layer. AFAIK, once one view is layer-backed, every other view down the hierarchy gets its own layer.

    I'm not sure about many of the details of the framework, but have had significant help with the Core Animation book from Bill Dudney. Depending on how much you want to do with Core Animation, you may be interested in:

    Best of luck
  4. liptonlover thread starter macrumors 6502a

    Mar 13, 2008
    I had a regular app that was made using just a data model and an interface based on the default core data entity layout. To make it nicer, I decided to make the windows in the app fade in and out when opened/closed. So I created a subclass of NSView, and set up outlets and actions for the close/open buttons and the windows. All the windows are layer-backed. (All I did was use the checkbox in IB, I didn't do it programatically.)
    The fading in and out works great, it's a neat little effect. But when I open a window, either the "close" button or the "add" button will become transparent. It's still there, but transparent. If I resize the window, it will reappear until the app is quit and relaunched.

    I hope that explains it more clearly. I'm sorry but I don't really understand your solution :(

    I am interested in that book, but I don't know if I will end up buying it.

Share This Page