nsscrollview

NSScrollView detect scroll position

为君一笑 提交于 2019-12-06 11:45:50
问题 How can i detect scroll of position when the scroll at bottom? [[_scrollView contentView] setPostsBoundsChangedNotifications:YES]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(boundsDidChangeNotification:) name:NSViewBoundsDidChangeNotification object:[_scrollView contentView]]; - (void) boundsDidChangeNotification: (NSNotification *) notification { NSPoint currentScrollPosition = [[_scrollView contentView] bounds].origin; } 回答1: Update : My original answer was

Growing NSTextView to fit contents is clipping last line of text

本小妞迷上赌 提交于 2019-12-06 03:49:00
问题 I'm trying to create an NSTextView that grows vertically as the user types and scrolls once the height has reached a maximum. This is similar to the text view in Messages works. My first attempt uses the delegate to listen for text changes and adjust the height constraint associated with the NSTextView's scroll view: - (void)textDidChange:(NSNotification *)notification { NSTextView *textView = self.textView; NSRect usedRect = [textView.textContainer.layoutManager usedRectForTextContainer

Layer-backed NSView performance with rendering directly in CALayer.drawInContext:

泄露秘密 提交于 2019-12-05 11:14:39
I have many layer-backed views contained in a NSScrollview and am predominantly concerned with scrolling performance . The documentView and higher are layer-backed hence their subviews are also layer-backed. The following are the three natural places that display/rendering code could go: override NSView.wantsUpdateLayer to return false (or don't do anything because this is the default) & do drawing in NSView's drawRect method override NSView.wantsUpdateLayer to return true & do drawing in NSView's updateLayer method do NO drawing in NSView at all & perform all drawing in CALayer's

NSScrollView containing NSStackView. Why the NSStackView items from bottom to Top?

孤街浪徒 提交于 2019-12-05 08:47:54
The NSScrollView containing a NSStackView. The NSStackView's items will add in runtime.The new NSStackView's items are from bottom to top, but I want they are from top to bottom. The main.storyboard The ViewController import Cocoa class ViewController: NSViewController { var todoList:[Todo] = [] @IBOutlet weak var todosStackView: NSStackView! @IBOutlet weak var todosScrollView: NSScrollView! @IBAction func onEnter(sender: NSTextField) { let todo = Todo() todo.content = sender.stringValue self.todoList.append(todo) let todoItemView = TodoItem() todoItemView.setButtonType(.SwitchButton)

Stop NSScrollView only on specific values - Like UIScrollView paging

谁说我不能喝 提交于 2019-12-04 23:09:19
I am working on a Mac OS X app using SDK 10.7 as deployment target. A NSScrollView contains a horizontal list of image thumbnails. The thumbnail which is in the center of the ScrollView indicates the selected image which is shown below the ScrollView in full size. This works quite similar the the Finder Cover-Flow, beside that the images in my app do not flow but just scroll away. I would like to limit the scrolling to stop only when a thumbnail is exactly in the center. The NSView method adjustScroll: is no solution. This would disable "smooth" scrolling and let the ScrollView jump from one

How to disable scrolling in NSScrollView with enabled responsive scrolling

妖精的绣舞 提交于 2019-12-04 17:17:11
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/questions/41853163/how-to-disable-scrolling-in-nsscrollview-with-enabled-responsive-scrolling

Padding around an NSTextView in an NSScrollView

Deadly 提交于 2019-12-04 15:57:20
问题 I'd like to provide a few pixels of padding around an NSTextView inside of an NSScrollView. I've reviewed this post and using setTextContainerInset does the trick for the left, right, and bottom margins. But as soon as the text scrolls the top buffer is lost. Same thing with overriding textContainerOrigin. Another answer in that post states: The way TextEdit does it (when in Wrap to Page mode) is to put the text view inside of a larger view, and set that larger view as the document view of

Appending text to NSTextView in Swift 3

﹥>﹥吖頭↗ 提交于 2019-12-04 15:47:59
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've found for doing this seems to be Swift 2, and this is the one piece of the puzzle I'm missing.

NSScrollView detect scroll position

烈酒焚心 提交于 2019-12-04 15:35:00
How can i detect scroll of position when the scroll at bottom? [[_scrollView contentView] setPostsBoundsChangedNotifications:YES]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(boundsDidChangeNotification:) name:NSViewBoundsDidChangeNotification object:[_scrollView contentView]]; - (void) boundsDidChangeNotification: (NSNotification *) notification { NSPoint currentScrollPosition = [[_scrollView contentView] bounds].origin; } Update : My original answer was plain wrong. Thanks to JWWalker and Wil Shipley for making me aware of that via comments. Here's a hopefully

Creating a custom title bar on a standard NSWindow

风格不统一 提交于 2019-12-04 07:55:48
问题 I've been trying to build a specific look for my menubar app. I've been using a NSWindow with a NSBorderlessWindowMask style mask and setting [window setOpaque:NO] and [window setBackgroundColor:[NSColor clearColor]] . That gives me a blank canvas which works great for the title bar. Now I'm having problems with the view-based NSTableView I'm using for the listing. How can I clip the NSTableCellView s to the window's rounded corners? I started out just having a custom view wrapping the