简体   繁体   English

NSTextView(在NSScrollView内部)-如何知道是否需要滚动条?

[英]NSTextView (inside NSScrollView) - how can i know if scrollbar is required?

在NSTextView对象中设置字符串后,可以确定是否显示滚动条吗?

Simply compare the height of the NSTextView to the height of the NSScrollView . 只需将NSTextView的高度与NSScrollView的高度进行比较NSScrollView

if ([textView frame].size.height > [scrollView frame].size.height) {
    //Scrollbar will be shown.
}
else {
    //Scrollbar will not be shown.
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM