Ratio Justification

Three Children Partitioning a Parent

FIGURE 5.28 shows a parent view whose width is 180 and whose height is 120. It has three children which horizontally span the parent and which each take up one-third of the parent vertically. Here's a way to do it:

First child:

viewJustify
parentTop, siblingBottom, parentFull (horizontal), topRatio, bottomRatio

viewBounds
{top: 0, left: 0, bottom: 33, right: 0}

Second child:

viewJustify
parentTop, siblingBottom, parentFull (horizontal), topRatio, bottomRatio

viewBounds
{top: 33, left: 0, bottom: 66, right: 0}

Third child:

viewJustify
parentTop, siblingBottom, parentFull (horizontal), topRatio, bottomRatio

viewBounds
{top: 66, left: 0, bottom: 100, right: 0}

FIGURE 5.28 : A parent view with three children partitioning it.


For each of the views, the top and bottom slots of viewBounds are treated as percentages (due to the two ratio justifications) of the parent height. Therefore, the vertical viewBounds are interpreted as ranging from 0% to 33%, 33% to 66%, and 66% to 100% of the parent's height.


An online version of Programming for the Newton using Macintosh, 2nd ed. ©1996, 1994, Julie McKeehan and Neil Rhodes.

Last modified: 1 DEC 1996