[英]OSX Cocoa NSCollectionViewFlowLayout horizontal scroll on zoom / magnification not working
I want to make a zoom-able NSCollectionView
in OSX. 我想在OSX中制作一个可缩放的NSCollectionView
。 I use NSCollectionViewFlowLayout
with a vertical
flow and set allow magnification
to true on NSScrollView
, it works well. 我将NSCollectionViewFlowLayout
与vertical
流一起使用,并在NSScrollView
allow magnification
设置为true,效果很好。 But one thing that I notice is that I cannot do horizontal scroll. 但是我注意到的一件事是我无法进行水平滚动。 Is this because the NSCollectionViewFlowLayout
that prevents the horizontal scroll (Notice that I use vertical
flow)? 这是因为NSCollectionViewFlowLayout
阻止了水平滚动(请注意,我使用vertical
流)? I did debug the view hierarchy and found out that the zoomed-view was clipped inside NSClipView
, vertical scroll works, horizontal not. 我确实调试了视图层次结构,发现缩放视图是在NSClipView
内NSClipView
,垂直滚动有效,水平滚动没有。 Any idea? 任何想法? Do I need to create a custom NSCollectionViewFlowLayout
to do this? 我是否需要创建自定义NSCollectionViewFlowLayout
来执行此操作?
Try overriding: 尝试覆盖:
@property NSCollectionViewScrollDirection scrollDirection;
on your NSCollectionViewFlowLayout subclass to return NSCollectionViewScrollDirectionHorizontal
. 在您的NSCollectionViewFlowLayout子类上返回NSCollectionViewScrollDirectionHorizontal
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.