nsscrollview

How can I get NSScrollView to respect a clipping path

走远了吗. 提交于 2019-12-01 01:35:25
I am trying to make a NSScrollView with clipped corners, similar to the Twitter app: I have a NSScrollView subclass which I added the following code: - (void)drawRect:(NSRect)dirtyRect { NSBezierPath *pcath = [NSBezierPath bezierPathWithRoundedRect:[self bounds] xRadius:kDefaultCornerRadius yRadius:kDefaultCornerRadius]; [path setClip]; [super drawRect:dirtyRect]; } I expected the content of the NSScrollView to have rounded corners, but it is not respecting the clipped path. How can I do this? UPDATE & CLARIFICATION I know how to make a custom NSScroller , I know how to make it transparent

How can I get NSScrollView to respect a clipping path

随声附和 提交于 2019-11-30 19:36:07
问题 I am trying to make a NSScrollView with clipped corners, similar to the Twitter app: I have a NSScrollView subclass which I added the following code: - (void)drawRect:(NSRect)dirtyRect { NSBezierPath *pcath = [NSBezierPath bezierPathWithRoundedRect:[self bounds] xRadius:kDefaultCornerRadius yRadius:kDefaultCornerRadius]; [path setClip]; [super drawRect:dirtyRect]; } I expected the content of the NSScrollView to have rounded corners, but it is not respecting the clipped path. How can I do this

Programmatically set up NSTextView inside NSScrollView

为君一笑 提交于 2019-11-30 17:22:09
问题 I'm trying to set up an NSTextView in an NSScrollView programmatically and am having trouble. Specifically, I can't scroll the text view; the scroll view seems to think "this is all there is". When you try to scroll down to see the rest of the content (without releasing), this is the result: As soon as you release, the scroll view bounces back, so it's not a graphical glitch; it simply clips the text view at the frame height. I've tried experimenting with the Apple 'Text In ScrollView' docs

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

…衆ロ難τιáo~ 提交于 2019-11-30 13:56:36
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 out the elements in the correct location. This works well, when I run the app all the elements appear

How to determine if a user has scrolled to the end of an NSTableView

寵の児 提交于 2019-11-30 06:41:02
问题 I have an NSTableView, and I would like to know when the user has scrolled to the bottom, so I can perform an action. Not quite sure how to go about this? UPDATE: Here is how I am calculating the bottom of the table: -(void)tableViewDidScroll:(CPNotification) notification { var scrollView = [notification object]; var currentPosition = CGRectGetMaxY([scrollView visibleRect]); var tableViewHeight = [messagesTableView bounds].size.height - 100; //console.log("TableView Height: " +

synchronize two NSScrollView

爷,独闯天下 提交于 2019-11-30 05:24:18
I read the document Synchronizing Scroll Views , and did exactly as the document, but there is an isssue. I want to synchronize a NSTableView and a NSTextView. first let NSTableView monitor NSTextView, and everything is ok when I scroll the TextView, but when I try to scroll TableView, I found that the TableView will jump to another place(maybe backward several rows) at first, then continue to scroll from that place. This issue still exists even after I let TextView monitor TableView. anyone know what's the problem? can't I synchronize a TableView and a TextView? Edited: OK, now I found that

Create NSScrollView Programmatically in an NSView - Cocoa

本秂侑毒 提交于 2019-11-30 00:50:00
I have an NSView class which takes care of a Custom View created in the nib file. Now I want to add an NSScrollView to the custom view, but I need to do it programmatically and not using Interface Builder (Embed Into Scroll View). I have found this code: NSView *windowContentView = [mainWindow contentView]; NSRect windowContentBounds = [windowContentView bounds]; scrollView = [[NSScrollView alloc] init]; [scrollView setBorderType:NSNoBorder]; [scrollView setHasVerticalScroller:YES]; [scrollView setBounds: windowContentBounds]; [windowContentView addSubview:scrollView]; Assuming I declare as

How to maintain the scroll position in NSScrollView when changing scale?

北城以北 提交于 2019-11-30 00:30:41
I've got an NSView (myView) wrapped in an NSScrollView (myScrollView). Using zoom-in/out buttons, the user can alter the scale of myView. If the user is currently scrolled to a particular spot in myView, I'd like to keep that part of the view on-screen after the zooming has taken place. I've got code that looks like this: // preserve current position in scrollview NSRect oldVisibleRect = [[myScrollView contentView] documentVisibleRect]; NSPoint oldCenter = NSPointFromCGPoint(CGPointMake(oldVisibleRect.origin.x + (oldVisibleRect.size.width / 2.0), oldVisibleRect.origin.y + (oldVisibleRect.size

synchronize two NSScrollView

我与影子孤独终老i 提交于 2019-11-29 03:44:43
问题 I read the document Synchronizing Scroll Views, and did exactly as the document, but there is an isssue. I want to synchronize a NSTableView and a NSTextView. first let NSTableView monitor NSTextView, and everything is ok when I scroll the TextView, but when I try to scroll TableView, I found that the TableView will jump to another place(maybe backward several rows) at first, then continue to scroll from that place. This issue still exists even after I let TextView monitor TableView. anyone

Create NSScrollView Programmatically in an NSView - Cocoa

被刻印的时光 ゝ 提交于 2019-11-28 23:20:06
问题 I have an NSView class which takes care of a Custom View created in the nib file. Now I want to add an NSScrollView to the custom view, but I need to do it programmatically and not using Interface Builder (Embed Into Scroll View). I have found this code: NSView *windowContentView = [mainWindow contentView]; NSRect windowContentBounds = [windowContentView bounds]; scrollView = [[NSScrollView alloc] init]; [scrollView setBorderType:NSNoBorder]; [scrollView setHasVerticalScroller:YES];