nsscrollview

Overlay NSScroller over content

久未见 提交于 2019-12-03 00:28:01
Is there any way to overlay the NSScroller over the content of the scroll view (like in iOS)? I've already tried several approaches: a) setting the frame of the scroll view content view (NSClipView) to extend into the bounds of the scroller b) adding an NSScroller object as a subview of the scroll view (positioned where I want) c) creating an entirely custom scroller view and placing it as a subview (this worked, but that would mean that I need to rewrite all the functionality of NSScroller) Sparrow seems to successfully do this, and it seems to do it through a regular NSScroller subclass

Creating a custom title bar on a standard NSWindow

时光毁灭记忆、已成空白 提交于 2019-12-02 19:43:13
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 NSTableView , drawing the background with rounded corners. Using [view addClip:path] doesn't clip child views

Multiple views layouting in NSScrollView using Visual AutoLayout

浪尽此生 提交于 2019-12-02 04:18:21
问题 I need to show multiple views aligned vertically inside NSScrollView , I started by adding NSTableView and NSButton . I aligned them vertically with NSTableView on top and NSButton on bottom. I added NSTableview and NSButton to an NSView called tempView . And then set the document view of NSScrollView to tempView . But problem i am having is my tableview does not expand properly i see the buttons alright but tablview does not expands properly and just show the last entries that fits in the

Multiple views layouting in NSScrollView using Visual AutoLayout

淺唱寂寞╮ 提交于 2019-12-01 23:50:27
I need to show multiple views aligned vertically inside NSScrollView , I started by adding NSTableView and NSButton . I aligned them vertically with NSTableView on top and NSButton on bottom. I added NSTableview and NSButton to an NSView called tempView . And then set the document view of NSScrollView to tempView . But problem i am having is my tableview does not expand properly i see the buttons alright but tablview does not expands properly and just show the last entries that fits in the table. As you can see in following image it displays last 4 rows of 20 rows. ] My code is as follow -

Programmatically scroll NSScrollView to the right

可紊 提交于 2019-12-01 13:52:08
Everything is in the title; I want to programmatically scroll an NSScrollView to the right so I can see the end of my document. I tried this : let width = scrollView.frame.size.width let height = scrollView.frame.size.height let toRight = CGRectMake(width, 0, width, height) scrollView.scrollRectToVisible(toRight) But it didn't do anything. Any help would be appreciated ! I finally got it to work by scrolling the content view : scrollView.contentView.scrollPoint(NSPoint(width, 0)) Try let toRight = CGRect(x: width, y: 0, width: 0, height: height) scrollView.scrollRectToVisible(toRight) 来源:

Sort the contents of an NSScrollView, NSTableView, using Binding in ArrayController

旧时模样 提交于 2019-12-01 13:01:59
问题 I have an NSScrollView wich is bound with an ArrayController . I need to sort the content alphabetically. I've tried to do this with bindings but I can't find the right thing to bind. I used the following sortDescriptor on my ArrayController . [myArrayController setSortDescriptors:[NSArray arrayWithObject:[NSSortDescriptor sortDescriptorWithKey:@"myKey" ascending:YES selector:@selector(compare:)]]]; Do I miss a step in the process or am I not even close to sorting the content? 回答1: Did you

Programmatically scroll NSScrollView to the right

∥☆過路亽.° 提交于 2019-12-01 12:40:33
问题 Everything is in the title; I want to programmatically scroll an NSScrollView to the right so I can see the end of my document. I tried this : let width = scrollView.frame.size.width let height = scrollView.frame.size.height let toRight = CGRectMake(width, 0, width, height) scrollView.scrollRectToVisible(toRight) But it didn't do anything. Any help would be appreciated ! 回答1: I finally got it to work by scrolling the content view : scrollView.contentView.scrollPoint(NSPoint(width, 0)) 回答2:

Rounded corners on NSTableView

♀尐吖头ヾ 提交于 2019-12-01 12:07:28
I have a custom view subclass similar to NSBox that draws a rounded box background. The problem is that if I place a view like an NSTableView in the box view, it does not clip to the rounded corners. Is there any way to round the corners of NSTableView and its parent scroll view? I haven't tried this with a table view but have with other controls. In a subclass of NSTableView (or whatever view/control you want to clip) Override drawRect: Create an NSBezierPath with the shape you want (probably appendBezierPathWithRoundedRect:xRadius:yRadius: just remember to use the view's bounds as the size)

How to observe NSScroller changes?

只谈情不闲聊 提交于 2019-12-01 06:22:32
I have an NSScrollView subclass and I would like to update another NSView based on the current scroll position. I tried KVC-observing the value of [self horizontalScroller] but that never gets called. // In awakeFromNib [[self horizontalScroller] addObserver:self forKeyPath:@"value" options:NSKeyValueObservingOptionNew context:NULL]; // Later in the file - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { if (object == [self horizontalScroller] && [keyPath isEqualToString:@"value"]) { // This never gets called } } Do

How to observe NSScroller changes?

感情迁移 提交于 2019-12-01 04:16:45
问题 I have an NSScrollView subclass and I would like to update another NSView based on the current scroll position. I tried KVC-observing the value of [self horizontalScroller] but that never gets called. // In awakeFromNib [[self horizontalScroller] addObserver:self forKeyPath:@"value" options:NSKeyValueObservingOptionNew context:NULL]; // Later in the file - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { if (object ==