Toolbars, TableViews and Animation

  • Hi all,
    I am running across a strange drawing bug when using animation to
    change a views frame size and swap in a new subview.  An example I
    have come across is when working with the BasicCocoaAnimations example
    project.  You can find this project by doing a search in the developer
    documentation.  I added a tableview to the medium view in the
    MainWindow.nib file.  The tableview I added stretches almost from the
    top to the bottom of the view.  The problem comes when you run the app
    and move from the small view to the medium view.  The code figures out
    the new size for the window and calls

    [[[self window] animator] setFrame:newFrame display:YES];
    [[[[self window] contentView] animator] replaceSubview:previousView with:view];

    to smoothly change the window size and fade out the old view and fade
    in the new view.  However when the window starts resizing the window,
    the tableview seems to have problems redrawing correctly as it is
    fading/sliding into place.  It almost looks like part of the toolbar
    is sticking to the tableview.  Has anyone else come across an issue
    like this or am I simply doing something wrong here?  I would be happy
    to send the modified project to anyone who would like to take a look.
    Thanks for the help.

    Sincerely,
    Doug Penny
  • On Oct 30, 2007, at 6:17 AM, Doug Penny wrote:

    > Hi all,
    > I am running across a strange drawing bug when using animation to
    > change a views frame size and swap in a new subview.  An example I
    > have come across is when working with the BasicCocoaAnimations example
    > project.  You can find this project by doing a search in the developer
    > documentation.  I added a tableview to the medium view in the
    > MainWindow.nib file.  The tableview I added stretches almost from the
    > top to the bottom of the view.  The problem comes when you run the app
    > and move from the small view to the medium view.  The code figures out
    > the new size for the window and calls
    >
    > [[[self window] animator] setFrame:newFrame display:YES];
    > [[[[self window] contentView] animator] replaceSubview:previousView
    > with:view];

    Ah, I see you are using Leopard -- are you using layer backed views?
    (ie: CoreAnimation?)

    > to smoothly change the window size and fade out the old view and fade
    > in the new view.  However when the window starts resizing the window,
    > the tableview seems to have problems redrawing correctly as it is
    > fading/sliding into place.  It almost looks like part of the toolbar
    > is sticking to the tableview.  Has anyone else come across an issue
    > like this or am I simply doing something wrong here?  I would be happy
    > to send the modified project to anyone who would like to take a look.
    > Thanks for the help.

    I haven't tried to reproduce your problem, but one thought could be
    tableView caching the contents in "live resize". To thwart this,
    subclass NSTableView, override drawRect: and just call [super
    drawRect:]. Does that fix it?

    corbin
  • On 10/30/07, Corbin Dunn <corbind...> wrote:
    >
    > On Oct 30, 2007, at 6:17 AM, Doug Penny wrote:
    >
    >> Hi all,
    >> I am running across a strange drawing bug when using animation to
    >> change a views frame size and swap in a new subview.  An example I
    >> have come across is when working with the BasicCocoaAnimations example
    >> project.  You can find this project by doing a search in the developer
    >> documentation.  I added a tableview to the medium view in the
    >> MainWindow.nib file.  The tableview I added stretches almost from the
    >> top to the bottom of the view.  The problem comes when you run the app
    >> and move from the small view to the medium view.  The code figures out
    >> the new size for the window and calls
    >>
    >> [[[self window] animator] setFrame:newFrame display:YES];
    >> [[[[self window] contentView] animator] replaceSubview:previousView
    >> with:view];
    >
    > Ah, I see you are using Leopard -- are you using layer backed views?
    > (ie: CoreAnimation?)

    Yes, this is in Leopard... sorry I left that out of the first post.  I
    am calling setWantsLayer: on the contentView of the window in
    awakeFromNib:

    >
    >> to smoothly change the window size and fade out the old view and fade
    >> in the new view.  However when the window starts resizing the window,
    >> the tableview seems to have problems redrawing correctly as it is
    >> fading/sliding into place.  It almost looks like part of the toolbar
    >> is sticking to the tableview.  Has anyone else come across an issue
    >> like this or am I simply doing something wrong here?  I would be happy
    >> to send the modified project to anyone who would like to take a look.
    >> Thanks for the help.
    >
    > I haven't tried to reproduce your problem, but one thought could be
    > tableView caching the contents in "live resize". To thwart this,
    > subclass NSTableView, override drawRect: and just call [super
    > drawRect:]. Does that fix it?
    >
    > corbin
    >

    Gave this a try and it doesn't seem to make a difference.  Thanks for
    the suggestion.

    Sincerely,
    Doug Penny
previous month october 2007 next month
MTWTFSS
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31        
Go to today