Re: drawRect not called when hosting Layers
Re: drawRect not called when hosting Layers
- Subject: Re: drawRect not called when hosting Layers
- From: Gustavo Pizano <email@hidden>
- Date: Thu, 6 May 2010 20:32:36 +0200
David thanks for the info about the drawing.
Im looking at the zombie error, and it seems the CALayer where Im putting the animation its being deallocated, even have something like:
CALayer * quickEdit;
@property(nonatomic, retain)CALayer * quickEdit;
and in the .m file
quickEdit = [CALayer layer];
I think I tried also [self setAnimLayer:[CALayer layer]]
with same results,..
I will let you know,
...
...
I have tried this: Setting the customView to [customView setWantLayer:YES] in the awakeFromNib.
in the updateTrackingArea:
quickEdit = nil;
NSImage * imge = [NSImage imageNamed:@"infoOffState.png"];
quickEdit = [CALayer layer];
quickEdit.contents = imge;
quickEdit.opacity = 0.0;
[[self layer] addSublayer:quickEdit];
NSRect rect = NSMakeRect(self.bounds.size.width - 25.0, 9.0, 15.0, 15.0);
quickEdit.frame = rect;
ta=nil;
ta = [[NSTrackingArea alloc] initWithRect:quickEdit.frame options:NSTrackingActiveInActiveApp|NSTrackingMouseEnteredAndExited owner:self userInfo:[NSDictionary dictionaryWithObject:@"quickLook" forKey:@"view"]];
[self addTrackingArea:ta];
[ta release];
and it seems Im not getting a Zombie now after transitions. but when I add another subview to the superview(the one which contains the customView), if this subview its "on" the customView which has wantLayer == YES, then that viewI just added its beneath the customView...
Any way to make it appear above... I guess this behavior its because the customView its a layer backed view.
thx
Gustavo
On May 6, 2010, at 6:39 PM, David Duncan wrote:
> On May 6, 2010, at 8:09 AM, Gustavo Pizano wrote:
>
>> BUT the view controller of the super view that holds that particular view in fact its controls 2 view controllers witch their respective views, the one mentioned above and another one.
>> So when I swap the view controllers and change the view, and I try to go back I get an “EXC_BAD_ACCESS , because the layer that will perform the animation couldn't get again its frame, I tought it was becuase I wasn't retaining the view before swapping for the other one, but no, I was retaining, removing from superview adding the other view controller as the current controller and adding its view to the main controller's view.
>
> Not sure why this would be exactly, but I would recommend debugging this route a bit more...
>
>> notices the comment on line 3, If I comment line, the drawRect of the view its called, but I don't see any animation when the mouse enter the specific tracking area, but if I don't comment it, the drawRect its never called, but I see the animation being displayed when mouseEnter .
>
>
> When you create a layer hosting view (that is, assign a layer directly to the view) then -drawRect: will not be called. This is to prevent AppKit from overwriting the content you may have assigned to the layer. And if you don't enabling layer backing, then AppKit won't display the layer and thus won't display your animation.
> --
> David Duncan
> Apple DTS Animation and Printing
>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden