drawRect not called when hosting Layers
drawRect not called when hosting Layers
- Subject: drawRect not called when hosting Layers
- From: Gustavo Pizano <email@hidden>
- Date: Thu, 6 May 2010 17:09:47 +0200
Hello, all.
I need to place a CAanimation in of subview when mouse enters a Tracking area, the problems I had were:
-I set up the view to [self setWantsLayer:YES];
-added the layer that will perform the animation;
when I entered the mouse all was perfect I see the animation.
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.
So i decided to change the tactic, and instead of telling this particular custom view just [self setWantsLayer:YES]; I did the follwing:
CALayer * layer = [[CALayer new] autorelease];
[self setLayer:layer];
// [self setWantsLayer:YES];
NSImage * imge = [NSImage imageNamed:@"infoOffState.png"];
quickEdit = [CALayer layer];
quickEdit.contents = imge;
quickEdit.opacity = 0.0;
[[self layer] addSublayer:quickEdit];
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 .
what am I doing wrong?
do I have it all messed up?
:S
thanks
Fustavo
_______________________________________________
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