登录 用户中心() [退出] 后台管理 注册
   
您的位置: 首页 >> SoftHub关联区 >> 主题: [macos/ios/appkit] NSScrollView滚动条怎么让它停在指定的位置或者点 [zt]     [回主站]     [分站链接]
[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)];




总数:0 页次:1/0 首页 尾页  
总数:0 页次:1/0 首页 尾页  


所在合集/目录
appkit的坑 更多
appkit 更多



发表评论:
文本/html模式切换 插入图片 文本/html模式切换


附件:



NEWBT官方QQ群1: 276678893
可求档连环画,漫画;询问文本处理大师等软件使用技巧;求档softhub软件下载及使用技巧.
但不可"开车",严禁国家敏感话题,不可求档涉及版权的文档软件.
验证问题说明申请入群原因即可.

Copyright © 2005-2020 clq, All Rights Reserved
版权所有
桂ICP备15002303号-1