Entity view (Content)

Sproutcore Layout Tip

By dliau
Sep. 29, 2011

This may be more relevant for Sproutcore 1.6, I haven't had the chance to use 2.0 yet. The layout property in a View will accept a decimal value. I've seen some forums use a percentage as a string which seemed to be deprecated. But a decimal value would translate into a percentage. This makes it very easy to allow apps to scale if they are viewed on tablets or phones.

myView: SC.ScrollView.design({
  layout: {top: 0.25, left: 0.25, right: 0.25, bottom: 0.25},
  ...
})

This would create a box that scales to 25% of each side. Hope this help!

Post Tags: