例如,如果我们要在主视图上绘制一个 100 x 100 像素的圆圈,覆盖 iPad 上的整个屏幕,则不要使用initWithFrame以下 2 个步骤viewDidLoad:
UINodeView *nodeView = [[UINodeView alloc] initWithFrame:
CGRectMake(x, y, NSNodeWidth, NSNodeHeight)];
nodeView.center = CGPointMake(x, y);
因为x和y更优雅地self.view.bounds.size.width / 2将圆水平居中,而不是self.view.bounds.size.width / 2 - NSNodeWidth / 2. 是先按init帧,然后重置中心的好方法,还是有更好的方法,如果有initWithCenterAndSize?