nsscrollview

NSScrollView how to start from top left corner

痴心易碎 提交于 2021-02-10 08:43:07
问题 How to set scrollView document view to be pinned to top left corner? If scrollView is big enough/bigger than its content, everything is drawn from bottom to up and it not looks right. I have to override isFlipped of scrollView? I was searching internet and overriding isFlipped to return true is not everything. I don't want to make my documentView flipped because then I have to make changes in that class to make everything looks like I want. 回答1: I created simple NSView class as an container

Auto-Resizing of NSTextView and/or NSScrollView

南笙酒味 提交于 2021-02-07 08:23:00
问题 I have an NSTextView inside an NSView (which is being used by a NSPopover , don't know if that is relevant) that I'm trying to resize automatically and programmatically (cf caption). I have been struggling with a lot of stuff, namely : Looking at NSLayoutManager and usedRectForTextContainer that give me aberrant size values ( usedRectForTextContainer : {{0, 0}, {0.001, 28}} ) Modifying NSScrollView frame , [NSScrollView contentView] , [NSScrollView documentView] Getting rid of AutoLayout I

Auto-Resizing of NSTextView and/or NSScrollView

*爱你&永不变心* 提交于 2021-02-07 08:21:30
问题 I have an NSTextView inside an NSView (which is being used by a NSPopover , don't know if that is relevant) that I'm trying to resize automatically and programmatically (cf caption). I have been struggling with a lot of stuff, namely : Looking at NSLayoutManager and usedRectForTextContainer that give me aberrant size values ( usedRectForTextContainer : {{0, 0}, {0.001, 28}} ) Modifying NSScrollView frame , [NSScrollView contentView] , [NSScrollView documentView] Getting rid of AutoLayout I

NSTableView in NSScrollView doesn't autoscroll when dragging

半世苍凉 提交于 2021-02-04 19:46:25
问题 I'm currently implementing drag and drop rearranging in a table view in my OS X app. While normal scrolling works fine, autoscroll while dragging it totally broken. If I grab a cell and start dragging, autoscroll just tells the table to scroll to the top. If I manually scroll using the trackpad during dragging the table continually pops to the top. If I drag one of the top cells, the table will not autoscroll down when dragging near the bottom. I subclassed NSScrollView and overrode the

NSCollectionView custom layout enable scrolling

纵然是瞬间 提交于 2020-01-31 05:28:44
问题 I can't get scrolling both vertically and horizontally to work with a custom layout for NSCollectionView. According to the docs, in my subclass I return the `collectionViewContentSize' and if that is too big, scrolling is automatically enabled in the enclosing scroll view of the collection view. However, even if I order all elements in a horizontal row, only vertical scrolling is enabled. Here is a screenshot: http://i.stack.imgur.com/tMbCN.png Here is my layout code: import Cocoa class

NSCollectionView custom layout enable scrolling

拜拜、爱过 提交于 2020-01-31 05:27:29
问题 I can't get scrolling both vertically and horizontally to work with a custom layout for NSCollectionView. According to the docs, in my subclass I return the `collectionViewContentSize' and if that is too big, scrolling is automatically enabled in the enclosing scroll view of the collection view. However, even if I order all elements in a horizontal row, only vertical scrolling is enabled. Here is a screenshot: http://i.stack.imgur.com/tMbCN.png Here is my layout code: import Cocoa class

How to pass scroll events to parent NSScrollView

假装没事ソ 提交于 2020-01-12 16:50:47
问题 I need fixed-size NSTextViews inside a larger scrolling window. IB requires that the textviews be inside their own NSScrollViews, even though their min/max sizes are fixed so that they won’t actually scroll. When trackpad gestures are made within the textview frames (regardless of whether they have focus), they are captured by the textviews’ scrollviews, so nothing happens. How do I tell the textviews’ scrollviews to pass scroll events up to the window’s main scrollview? (Or perhaps I should

How to pass scroll events to parent NSScrollView

﹥>﹥吖頭↗ 提交于 2020-01-12 16:50:09
问题 I need fixed-size NSTextViews inside a larger scrolling window. IB requires that the textviews be inside their own NSScrollViews, even though their min/max sizes are fixed so that they won’t actually scroll. When trackpad gestures are made within the textview frames (regardless of whether they have focus), they are captured by the textviews’ scrollviews, so nothing happens. How do I tell the textviews’ scrollviews to pass scroll events up to the window’s main scrollview? (Or perhaps I should

Automatically grow document view of NSScrollView using auto layout?

随声附和 提交于 2020-01-11 15:39:08
问题 Is there a simple way to get an NSScrollView to adapt to its document view changing size when using auto layout? I have tried to call both setNeedsUpdateConstraints: and setNeedsLayout: on the document view, the clip view and the scroll view, without any results. fittingSize of the document view reports the correct size. The problem is that the document view, which holds subviews, is not re-sized when the subviews change their size, even if they call invalidateIntrinsicContentSize . The

Custom NSView embedded in NSSscrollView

不问归期 提交于 2020-01-05 09:11:43
问题 Is there a way for a custom NSView to know whether it is embedded in a NSScrollView or not? I am creating a custom NSView for displaying some content. When my view is placed in a window or another view, its size is fixed and the content is clipped to available size. When my view is placed in a NSScrollView its size must be adjusted according to content so it can be scrolled if necessary. I know I can add a member in my view that specifies the NSScrollView that hosts my view and set this