Objective c 如何通过更改子视图的位置来避免失真
我有一个Objective c 如何通过更改子视图的位置来避免失真,objective-c,xcode,cocoa,Objective C,Xcode,Cocoa,我有一个NSViewController,我用代码分配给我的主应用程序: self.masterViewController = [[MasterViewController alloc] initWithNibName:@"MasterViewController" bundle:nil]; [self.window.contentView addSubview:self.masterViewController.view]; 我还设置了自动调整大小属性,这样,如果我更改主窗口的大小,子视
NSViewController
,我用代码分配给我的主应用程序:
self.masterViewController = [[MasterViewController alloc] initWithNibName:@"MasterViewController" bundle:nil];
[self.window.contentView addSubview:self.masterViewController.view];
我还设置了自动调整大小属性,这样,如果我更改主窗口的大小,子视图将相应地更改
到目前为止还不错。问题是子视图没有连接到主窗口的顶部,因此我添加了以下行:
self.masterViewController.view.frame = CGRectMake(0,120, self.masterViewController.view.frame.size.width, self.masterViewController.view.frame.size.height);
现在,通过这条线,我看到了实际的问题。子视图的图形被扭曲
这里可以看到问题:
谢谢你的帮助
-微型断路器