On Feb 11, 2010, at 4:54 PM, PCWiz wrote:

> The gradient works fine. Now this view has a subview (custom UIView subclass, 
> added in Interface Builder) that draws a line. The problem is that the 
> CAGradientLayer goes OVER the subview of the main view. If I comment out the 
> code that creates the CAGradientLayer, I can see the contents of the subview 
> just fine. Is there any way to make this CAGradientLayer go UNDER the subview?


Views and Layers share the same geometric ordering, that is what a view draws 
over is dependent on the order of its corresponding layer. Your effectively 
adding your gradient layer after all of the other view's that your view 
controller loaded, thus it is drawing over the other views and their 
subviews/layers.

You need to either insert the gradient layer into the sublayers array first, or 
move the views that should be on top to after. You may also want to consider 
creating a UIView subclass that returns [CAGradientLayer class] from its 
+layerClass method and exports methods to configure the gradient layer, then 
you can do your layout in IB (although you would still need to configure it in 
code).
--
David Duncan
Apple DTS Animation and Printing

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to