• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: [iPhone] CALayer/UIView ordering
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [iPhone] CALayer/UIView ordering


  • Subject: Re: [iPhone] CALayer/UIView ordering
  • From: David Duncan <email@hidden>
  • Date: Thu, 11 Feb 2010 17:17:38 -0800

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 (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

References: 
 >[iPhone] CALayer/UIView ordering (From: PCWiz <email@hidden>)

  • Prev by Date: Re: [iPhone] custom CALayer drawing
  • Next by Date: Re: What classes have -init?
  • Previous by thread: [iPhone] CALayer/UIView ordering
  • Next by thread: Creating an Application Support folder
  • Index(es):
    • Date
    • Thread