English 中文(简体)
CALayer filters and bounds
原标题:

I m just starting writing some Core Animation code and I ve just spent a frustrating day trying to figure out a particular problem.

I have two layer-backed views that together make up a wizard/ assistant style user interface:

1) a custom background view that fills the entire window with an edge-to-edge gradient and a nice image on the left hand side 2) a smaller framed view on the right that acts as a home for changing dialog choices as you click the "forwards"/ "backwards" buttons: labels, controls, buttons, etc.

I ve "stolen" some example code that animates a lighting filter and thus produces a pulsating effect.

I ve added the animation and the filter to the custom background view s CALayer. It works fine, but the controls in the smaller framed view also pulsate!

I m at a loss to understand how that can be the case and I expect the controls to remain unaffected by the filter applied to the layer below it. Surely the CALayer associated with the smaller view should get composited on top of the background view s layer and everything on its layer should remain unaffected!?

I ve played around with various scenarios and it s clear to me that I m missing something very basic here.. please help!

问题回答

A CALayer s content filter affects the layer and its sublayers. From your question it sounds like the view on the right side is a subview of your background view, which effectively makes its layer a sublayer of the background s layer, and the filter will apply to it as well.

Depending on exactly what you are trying to do, you might have better luck with a background filter instead of content filter. If I understood your setup correctly, you should be able to set a background filter on the right side view instead of a content filter on the background view.





相关问题
Taking picture with QTCaptureView

Is it possible to simply take a picture and save it somewhere using a QTCaptureView and Apple s built-in iSight? I ve seen lots of tutorials on recording video but none on simply taking a picture. Any ...

Controlling OSX windows

I m trying to control windows of a foreign OSX applications from my application. I d like to 1. move the windows on the screen 2. resize the windows on the screen 3. change the currently active window ...

objective-c: Calling a void function from another controller

i have a void, like -(void) doSomething in a specific controller. i can call it in this controller via [self doSomething], but i don t know how to call this void from another .m file. I want to call ...

NSUndoManager and runModalForWindow:

I have a simple Core Data app which displays a list of entities in the main window. To create or add new entities, I use a second modal window with a separate managed object context so changes can be ...

NSMutableArray values becoming "invalid"

I m trying to show a database information in a tableview and then the detailed information in a view my problem is as follow: I created a NSMutableArray: NSMutableArray *myArray = [[NSMutableArray ...

How to get a flash url in a webpage using a webframe?

As we know , When we load frame from webpage of safari, we will invoke the delegate methods of webkit informal protocol(WebFrameLoadDelegate): webView:didStartProvisionalLoadForFrame: webView:...

热门标签