Interactions between Parent and Sibling Justification

Example

The ability to define both parent and sibling justification can make it easier to specify one value for a whole set of views. For instance, you may want to set up a row of views that snap right next to each other. You can do this by using the following values for viewJustify and viewBounds:

viewJustify
vertical: parentRelativeFull and siblingNone
horizontal: parentRelativeleft and siblingRelativeRight

viewBounds
top: 5, bottom: -5, left: 0, right: 20

You'll end up with a row of views, with the first one at the left, each 20 pixels wide, touching one another, as shown in FIGURE 5.24.

FIGURE 5.24 : Using a combination of parentRelativeFull and siblingRelativeRight justification.


Another way to set up a row of views is to put the first one at the right, and put successive siblings to the left. You can do this by using the following values for viewJustify and viewBounds:

viewJustify
vertical: parentRelativeFull and siblingNone
horizontal: parentRelativeRight and siblingRelativeLeft

viewBounds
top: 5, bottom: -5, left: -20, right: 0

You'll end up with a row of views, with the first one at the right, each 20 pixels wide, touching one another, as shown in FIGURE 5.25.

FIGURE 5.25 : Using a combination of parentRelativeFull and siblingRelativeLeft justification.


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

Last modified: 1 DEC 1996