문제

I want to location a row to the top of a NSOutlineView. What I find is scrollRowToVisible:.But it only can location the row to the bottom of the NSOutlineView.

My OutlineView'scrollView is using autolayout and the row height is variable.So I don't want to get the scrollView'height by its constraints then do some calculate and use scrollRowToVisible: by plus the calculate'result.

Any other ideas?

도움이 되었습니까?

해결책

answer my own question:

NSRect rect=[_tableView rectOfRow:row];
[_tableView.enclosingScrollView.documentView scrollPoint:rect.origin];
[_tableView.enclosingScrollView displayIfNeeded];
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top