==================方法============
- (void)drawRect:(CGRect)rect;Draws the receiver’s image within the passed-in rectangle.
参数说明,rect:The portion of the view’s bounds that needs to be updated. The first time your view is drawn, this rectangle is typically the entire visible bounds of your view. However, during subsequent drawing operations, the rectangle may specify only part of your view.
调用时候:when a view is first displayed or when an event occurs that invalidates a visible part of the view. You should never call this method directly yourself. To invalidate part of your view, and thus cause that portion to be redrawn, call the setNeedsDisplay or setNeedsDisplayInRect: method instead。
Discussion:
1.The default implementation of this method does nothing.
2.If you subclass UIView directly, your implementation of this method does not need to call super. However, if you are subclassing a different view class, you should call super at some point in your implementation。
------备注:
--1.关于UIViewController的View属性frame大小:[[ViewController alloc]init] 之后,如果Status bar 是不显示的(Status bar is initially hidden属性),则它的frame为(0.000000,0.000000,480.000000,320.000000)反之为(0.000000,20.000000,460.000000,320.000000)。,所以这会造成有的时候,一个控制器视图add另一个控制器视图后,上面有一条缝隙。
另:如果一个控制器viewController被UINavigationController初始化initWithRootViewController了,然后即使viewController的视图frame设置特定值了,但如果addSubview是navigationController.view 那之前的frame值没起到作用。
所以当view上面有缝隙的时候,有可能是view的frame默认高度为20,也有可能你修改了view的frame默认高度为0,但显示还是navigationController.view。
如果控制器视图显示navigationController.view,则可能会出现俩个navigationbar的样子。