Here's a hypothetical question:
Say I subclass a UIView
that draws a triangle and I want this triangle uiview to part of the screen. And then say I subclass another UIView
that draws a rectangle and I want the rectangle to take part of the screen.
In other words:
- Can a view-control开发者_如何学JAVAler have multiple views simultaneously being drawn on the screen
- If so, can I set location bounds for these views. Say I want a view 50x50 on the left side of the screen etc?
- Can I specify the bounds via interface builder?
A view controller owns a view hierarchy, not just a single view. However, that hierarchy must have a root at some top level view, which ends up being self.view for the view controller.
The view that is self.view need not have any direct content to display. It can simply be a UIView that holds other views, your rectangle and circle. The root view should be large enough to cover (really be under) any other views it contains. All the views in the hierarchy may be laid out in interface builder.
- yes
- yes
- yes
精彩评论