nsscrollview

NSScrollView: fade in a top-border like Messages.app

瘦欲@ 提交于 2020-01-03 01:48:41
问题 What I Want to Do: In Messages.app on OS 10.10, when you scroll the left-most pane (the list of conversations) upwards, a nice horizontal line fades in over about 0.5 seconds. When you scroll back down, the line fades back out. What I Have: I am trying to achieve this effect in my own app and I've gotten very close. I subclassed NSScrollView and have done the following: - (void) awakeFromNib { _topBorderLayer = [[CALayer alloc] init]; CGColorRef bgColor = CGColorCreateGenericGray(0.8, 1.0f);

Subclassing NSScroller, how to get rid of the white square in the lower right corner?

旧时模样 提交于 2020-01-01 15:57:53
问题 I've created an iTunes like subclass of NSScroller, however if both the horizontal and vertical scrollers are visible in an NSScrollView or NSTableView I'm left with an ugly white square in the lower right corner. Anyone has a clue on where to add my custom drawing to fill that in with something prettier? 回答1: Ok, I think I have the solution(s). Either you tell the scrollview not to draw its background, in that case anything below it will fill the corner. Or, which is what I did, you override

Subclassing NSScroller, how to get rid of the white square in the lower right corner?

梦想的初衷 提交于 2020-01-01 15:57:04
问题 I've created an iTunes like subclass of NSScroller, however if both the horizontal and vertical scrollers are visible in an NSScrollView or NSTableView I'm left with an ugly white square in the lower right corner. Anyone has a clue on where to add my custom drawing to fill that in with something prettier? 回答1: Ok, I think I have the solution(s). Either you tell the scrollview not to draw its background, in that case anything below it will fill the corner. Or, which is what I did, you override

Get height of content in NSTableView

一笑奈何 提交于 2020-01-01 05:22:33
问题 Is there a way to get the height of the content in an NSTableView . In iOS, you can use the -contentSize method of UIScrollView . However, the -contentSize method of NSScrollView seems to just return the height of only the visible section of the NSScrollView , not including whatever is offscreen. So, how can this be done on a Mac? 回答1: - (NSSize)contentSize in Appkit returns the size of the NSClipView , and not the height of the content that scrolls inside the table view. I don't know how

Enabling NSScrollView to scroll its contents using Auto Layout in Interface Builder

旧巷老猫 提交于 2019-12-30 04:40:08
问题 I have implemented a custom NSView which contains many NSTextField s and other NSView s. I then embedded that custom view in a scroll view using Editor > Embed In > Scroll View. This creates the appropriate hierarchy as visible in the Outline, but I needed to then add Auto Layout constraints to specify where this scroll view should be placed within the view (top, bottom, leading, trailing). Additionally I had to add constraints for the custom view, set against the clip view, in order to lay

Shrink NSScroller of NSScrollView in layer-backed view

荒凉一梦 提交于 2019-12-24 15:07:28
问题 I'm experiencing a weird problem (Bug?): Say I have a WebView , which will scroll vertically. I now want to shrink the mainFrame 's vertical scroller a little bit, so that its height is smaller than the NSScrollView itself. The reason for this is that I want to pin two views (on top and on bottom edge) above the webview. I did that easily in the frameLoad delegate method by altering the verticalScroller's frame (altering origin and height). It works, but: However once I set the webView and it

Keep same NSTableView scrolled position while inserting rows

ⅰ亾dé卋堺 提交于 2019-12-24 10:57:42
问题 I've got a view-based NSTableView showing a timeline of messages/informations. Row heights are variable. New messages are regularly added at the top of the table by using insertRows : NSAnimationContext.runAnimationGroup({ (context) in context.allowsImplicitAnimation = true self.myTable.insertRows(at: indexSet, withAnimation: [.effectGap]) }) While the user stays at the top of the table, the messages keep being inserted at the top, pushing down the existing ones: a usual behavior in this

Appending text to NSTextView in Swift 3

左心房为你撑大大i 提交于 2019-12-22 00:09:02
问题 I am building an application that utilizes an MDM API to make bulk updates to attributes of devices. I am looking to have some sort of visible output/logging in the main view so that the user can see what lines of their CSV may have failed and what the HTTP Response Code was. I can append to an NSTextField or a label easy enough, but seeing as how there may be a large output with many lines, I'd like to have a scrollable text box to append the information to. All of the documentation that I

How to disable scrolling in NSScrollView with enabled responsive scrolling

白昼怎懂夜的黑 提交于 2019-12-21 21:32:44
问题 I need to disable programmatically scrolling in NSSrollView with enabled responsive scrolling. I try override isCompatibleWithResponsiveScrolling , then is possible to override scrollWheel and have enabled responsive scrolling but scrollWheel works different in that implementation. Is called only once, on start of scroll but I want to break scroll that is in progress. It's possible to do this in different way that not need to override scrollWheel method? 来源: https://stackoverflow.com

NSCollectionView How to scroll to selected item

我们两清 提交于 2019-12-21 20:37:46
问题 I programmatically select a item in my NSCollectionView. The item is selected as expected but the view doesn't scroll automatically to this item. [collectionView setSelectionIndexes:[NSIndexSet indexSetWithIndex:compt]]; How to scroll to the selected item ? 回答1: Find the answer here NSScrollView: Make sure frame is visible This code worked for me : NSRect selectionRect = [self.collectionView frameForItemAtIndex:[[self.collectionView selectionIndexes] firstIndex]]; [self.collectionView