以编程方式向右滚动NSScrollView [英] Programmatically scroll NSScrollView to the right
本文介绍了以编程方式向右滚动NSScrollView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
一切都在标题中;我想以编程方式向右滚动NSScrollView
,以便可以看到文档的结尾.
Everything is in the title; I want to programmatically scroll an NSScrollView
to the right so I can see the end of my document.
我尝试过这个:
let width = scrollView.frame.size.width
let height = scrollView.frame.size.height
let toRight = CGRectMake(width, 0, width, height)
scrollView.scrollRectToVisible(toRight)
但是它什么也没做.
任何帮助将不胜感激!
推荐答案
我终于通过滚动内容视图使它起作用:
I finally got it to work by scrolling the content view :
scrollView.contentView.scrollPoint(NSPoint(width, 0))
这篇关于以编程方式向右滚动NSScrollView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文