0

I have a few instances of ASScrollNodes in my UIScrollViewController, and in my viewDidLayoutSubviews I'm doing the following, where someScrollNode is an instance of ASSCrollNode:

someScrollNode.backgroundColor = UIColor.redColor()

However when the node renders I'm seeing the background show as black.

I ended up working around this by doing:

someScrollNode.view.backgroundColor = UIColor.redColor()

Which did work.

My understanding is that the backgroundColor property on an ASDisplayNode is a pass through to the view or layer's backgroundColor property depending on whether it is layer or view backed.

In this case, since it is a ASScrollNode, it is backed by a UIScrollView, so setting the backgroundColor on the ASScrollNode should be setting the backgroundColor on the UIScrollView when the view is actually created, or on display if it already exists.

Can anyone explain this behavior?

  • Well the backgroundColor property on ASDisplayNodes form my understanding is a pass through to the view or layer's backgroundColor property depending on whether it is layer or view backed, in this case since it is a ASScrollNode it is backed by a UIScrollView, so setting the backgroundColor on the ASScrollNode should be setting the backgroundColor on the UIScrollView when the view is actually created, or on display if it already exists, so I'm not sure why in this case it is not working but others it is – Jonathan E Aug 12 '15 at 16:24
  • There we go, I edited your question to extend the explaination. Let's delete these comments and see if you get better traction now that the question explains a bit better. – Madness Aug 12 '15 at 16:31
  • By the way, welcome to SO! You actually participating in discussion shows us that you are well on your way to being a valued member of the community. PARTICIPATION IS PARAMOUNT. Getting your post in line with the [How to ask page](http://stackoverflow.com/help/how-to-ask), as we have done, will benefit your questions greatly. – Madness Aug 12 '15 at 16:33
  • 1
    Thanks just gave it a read through, good to know – Jonathan E Aug 12 '15 at 17:04

0 Answers0