Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/cocoa/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Cocoa NSText的水平滚动条_Cocoa_Scrollbar_Nstextview - Fatal编程技术网

Cocoa NSText的水平滚动条

Cocoa NSText的水平滚动条,cocoa,scrollbar,nstextview,Cocoa,Scrollbar,Nstextview,全部, 我正在查看,但我不清楚: 要设置水平和垂直滚动条,请使用以下语句 在清单4中,替换前面的 清单 但是,它并没有说需要替换哪个块(或代码) 有人能帮我照一下吗 我正在寻找一种显示NSTextView水平滚动条的方法。苹果文档的编写方式不便于非英语母语人士理解 文档的意思是,除了清单1、清单2和清单3中的代码之外,用清单4中的代码替换前面清单中类似的(或“对应的”)行 换句话说,组合清单1、2、3,然后覆盖清单4中的内容,结果应该是这样的: NSScrollView *scrollview

全部,

我正在查看,但我不清楚:

要设置水平和垂直滚动条,请使用以下语句 在清单4中,替换前面的 清单

但是,它并没有说需要替换哪个块(或代码)

有人能帮我照一下吗


我正在寻找一种显示NSTextView水平滚动条的方法。

苹果文档的编写方式不便于非英语母语人士理解

文档的意思是,除了清单1、清单2和清单3中的代码之外,用清单4中的代码替换前面清单中类似的(或“对应的”)行

换句话说,组合清单1、2、3,然后覆盖清单4中的内容,结果应该是这样的:

NSScrollView *scrollview = [[NSScrollView alloc] initWithFrame:[[theWindow contentView] frame]];

NSSize contentSize = [scrollview contentSize];

[scrollview setBorderType:NSNoBorder];

[scrollview setHasVerticalScroller:YES];

[scrollview setHasHorizontalScroller:YES];

[scrollview setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];

theTextView = [[NSTextView alloc] initWithFrame:NSMakeRect(0, 0, contentSize.width, contentSize.height)];

[theTextView setMinSize:NSMakeSize(0.0, contentSize.height)];

[theTextView setMaxSize:NSMakeSize(FLT_MAX, FLT_MAX)];

[theTextView setVerticallyResizable:YES];

[theTextView setHorizontallyResizable:YES];

[theTextView setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)];

[[theTextView textContainer] setContainerSize:NSMakeSize(FLT_MAX, FLT_MAX)];

[[theTextView textContainer] setWidthTracksTextView:NO];

[scrollview setDocumentView:theTextView];

[theWindow setContentView:scrollview];

[theWindow makeKeyAndOrderFront:nil];

[theWindow makeFirstResponder:theTextView];

谢谢你,很有魅力。但苹果的文档是另一个问题