[macos/ios/appkit] NSScrollView滚动条怎么让它停在指定的位置或者点 [zt]
clq
浏览(361) -
2024-02-28 15:53:23 发表
编辑
关键字:
[macos/ios/appkit] NSScrollView滚动条怎么让它停在指定的位置或者点 [zt]
奇怪,实测只有这个是成功的。
https://zhidao.baidu.com/question/1947182192291320548.html
--------------------------------------------------------
以下代码应该可以的。
float ScrollLocation = 0.0;
float MaxScroll = 0.0;
[[m_textview enclosingScrollView] setLineScroll:0.0f];
[[m_textview enclosingScrollView] setPageScroll:0.0f];
ScrollLocation = [[[m_textview enclosingScrollView] contentView] bounds].origin.y;
MaxScroll = [[[m_textview enclosingScrollView] documentView] bounds].size.height - [[m_textview enclosingScrollView] documentVisibleRect].size.height;
ScrollLocation += 10;
if(ScrollLocation < 0)
{
ScrollLocation = 0;
}
else if(ScrollLocation >MaxScroll)
{
ScrollLocation = MaxScroll;
}
[m_textview scrollPoint:NSMakePoint(0, ScrollLocation)];
本帖子属于以下条目()
NEWBT官方QQ群1: 276678893
可求档连环画,漫画;询问文本处理大师等软件使用技巧;求档softhub软件下载及使用技巧.
但不可"开车",严禁国家敏感话题,不可求档涉及版权的文档软件.
验证问题说明申请入群原因即可.