3
NSOpenGLView에서 상속받은 ModelView라는 클래스가 있습니다. 내 프로그램이 실행되면 다음과 같이 ModelView를 주 윈도우에 연결합니다. 내 모델 뷰 클래스에서 NSOpenGLView 윈도우 크기 조정에서 크기 조정
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
// Insert code here to initialize your application
ModelView *glView;
NSRect glViewRect = CGRectMake(0.0f, 0.0f, window.frame.size.width, window.frame.size.height);
glView = [[ModelView alloc] initWithFrame: glViewRect];
[[window contentView] addSubview:glView];
}
내가 창 크기를 조절마다 발사하는 모양 변경 기능이
- (void)reshape
{
[super setNeedsDisplay:YES];
[[self openGLContext] update];
NSLog(@"reshap function called");
}
나는 내가 모델 뷰의 크기를 조정할 수 있도록 메인 윈도우의 폭을 싶어하지만 난 방법을 찾을 수 없습니다 모델 뷰 클래스에서 윈도우 폭을 얻을 수
내가 코코아/합리적 새로운 오전 오브젝티브 -C 그래서 어떤 도움 그래서,
감사를 사용하여있는 contentView 얻을 수 있지만
[[[self window] contentView] bounds].size.width
는 그러나 [[자기 parentView] 경계] 나에게 응답하지 않을 수 있습니다 경고 모델 뷰를 제공 .size.width, 폭을 줄 것이다 '-parentView', [[[self window] contentView] bounds] .size.width는 0을 반환합니다. 내가 도대체 뭘 잘못하고있는 겁니까 ?? – ADAM@ 아담 아, superview, edited를 잊어 버렸습니다. – cobbal