The following properties of the
UIView class are animatable:The geometry of a view is defined by its
frame, bounds, and center properties. The framedefines the origin and dimensions of the view in the coordinate system of its superview and is commonly used during layout to adjust the size or position of the view. The center property can be used to adjust the position of the view without changing its size. The bounds defines the internal dimensions of the view as it sees them and is used almost exclusively in custom drawing code. The size portion of the frame and bounds rectangles are coupled together so that changing the size of either rectangle updates the size of both.
The
addSubview: method places the specified view on top of other siblings. You can specify the relative z-order of a subview by adding it using theinsertSubview:aboveSubview: and insertSubview:belowSubview: methods. You can also exchange the position of already added subviews using theexchangeSubviewAtIndex:withSubviewAtIndex: method.
Initialization:
Drawing and printing:
Layout:
Event Handling:
Sample code:
CGRect viewRect = CGRectMake(10, 10, 100, 100); |
UIView* myView = [[UIView alloc] initWithFrame:viewRect]; [self addSubview:myView]; |