1
화면의 NSTextView에 텍스트를 추가하고 있으므로 전체 로그를보기 위해 스크롤 할 수 있어야합니다. 하지만 내 텍스트보기 스크롤을 가질 수 없습니다. 아래는 제 코드입니다. 어떤 생각이라도 틀렸어.NSTextView에서 스크롤이 작동하지 않습니다.
NSView *superview = [window contentView];
NSRect scrollViewFrame = NSMakeRect(10, self.window.frame.size.height/2 - 200, 400, 400);
NSScrollView *scrollview = [[NSScrollView alloc]
initWithFrame:scrollViewFrame];
NSSize contentSize = [scrollview contentSize];
[scrollview setBorderType:NSLineBorder];
[scrollview setHasVerticalScroller:YES];
[scrollview setHasHorizontalScroller:NO];
[scrollview setAutoresizingMask:NSViewWidthSizable|NSViewHeightSizable];
NSRect textViewFrame = NSMakeRect(0, 0, contentSize.width, contentSize.height);
self.logTextView = [[NSTextView alloc] initWithFrame:textViewFrame];
[self.logTextView setMinSize:NSMakeSize(0.0, contentSize.height)];
[self.logTextView setMaxSize:NSMakeSize(FLT_MAX, FLT_MAX)];
[self.logTextView setVerticallyResizable:YES];
[self.logTextView setHorizontallyResizable:NO];
[self.logTextView setAutoresizingMask:NSViewWidthSizable];
[scrollview addSubview:self.logTextView];
[superview addSubview:scrollview];