NSWindow won't allow resize until NSSplitView has been adjusted - objective-c

I have a new app (macOS, Cocoa, Objective-C) which is an Concrete subclass of NSWindow which contains a concrete subclass of NSSplitview with horizontal split. The splitview has some custom views in each panel.
The main window is resizable, but it won't allow you to resize in the normal manner (by dragging the frame) until you have nudged the splitview divider. After that the window can be resized at will.
Any ideas why the window won't resize until the splitview has been nudged?

Related

How do automatically resize an NSPopover with auto layout

I currently have an NSPopover subclass which sets it content view controller to a custom NSViewController meant to represent a tab view:
self.popover.contentViewController = tabViewController;
self.popover.animates = YES;
I'm rolling my own "tab view controller" because I've heard that NSTabViewController doesn't play well with animations. I'd like to use auto layout so I don't think I want to mess around with the popover's contentSize property. When I change tabs the popover correctly changes its size, however, it doesn't animate the change. Furthermore, I have a cross-fade animation that occurs when the tab view switches and the popover doesn't resize until after the animation finishes.
First, I'd like to figure out how to get the popover resize to animate and then I'll worry about getting the animation in sync.
Thanks

NSTextView does not scroll when created with NSCollectionView

I have an NSTextView that is on a view that is the view of an NSCollectionViewItem. I give the user the option to hide the NSTextView and instead bring up an NSView object in its place on the same view.
However, when I run the program with the NSView object hidden and overlapping the NSTextView, scrolling in the NSTextView does not work correctly; The vertical scroll bar is there and adjusts its size accordingly to the size of the content in the NSTextView. However, the actual scrolling only works by highlighting the NSTextView's content and dragging upwards or downwards. What's more is that if I recreate the view without it being connected to an NSCollectionViewItem and NSCollectionView, it scrolls fine. This is an issue that happens not just with the custom view I have overlapping the NSTextView, but with any view object (buttons, image wells, etc) that overlaps an NSTextView, even if the view object is set as hidden.
Why is scrolling only possible when highlighting and dragging upwards or downwards if the NSTextView is being created with NSCollectionView and there is a view object overlapping it?
Well, I have found a solution that makes little sense but seems to work fine. I subclassed NSTextView and overrode mouseEntered with this:
-(void) mouseEntered:(NSEvent *)theEvent {
NSScrollView *scrollView=(NSScrollView*)self.superview.superview;
NSScroller *scroller=scrollView.verticalScroller;
[scrollView setVerticalScroller:nil];
[scrollView setVerticalScroller:scroller];
}
If anyone has any idea as to why this issue is happening or a better solution and not just a guess-around, please post it

Scroll while dragging with DragImage

I'm trying to drag a view to another, I'm using DragImage method to pass data to my destination(another view), everything works fine, but while I'm dragging its container does not scroll.
the hierarchy:
NSWindow
NSScrollView
NSView -> NSScrollView's Document
NSViews -> NSView's subViews -> Drag and Drop between them.
I need to pass event
Any idea how to fix it?

NSScrollView + layer-backing

I have this hierarchy:
NSPageController -> NSScrollView -> NSView 1 (same size as scroll view) -> centered NSView 2 (a page in a catalog) -> more subviews (interactive elements on page)
this is from the NSPageController sample, I replaced the NSImageView there with NSView 1.
Now I want to enable layer-backing and set the wantsLayer and layer redraw policy.
The problem I'm having is that as soon as I turn layer backing on the NSScrollView it no longer properly updates the layer bounds of NSView 1 when zooming the scroll view with a pinch gesture on a trackpad.
What am I missing to have the trickle down of layer-backing work?
Also, I found that if I enable layer-backing beginning with NSView 2, then the resizing works, but the page image I'm drawing there looks very coarse. I moved to NSView 1 with the layer-backing because I also want a shadow on NSView 2 and this only shows up if the superview has layer-backing turned on as well.

Flip coordinate system of an NSWindow objective-c / cocoa

How can I flip the coordinate system of an NSWindow? I know it has a Content View, but how can I flip the coordinate system of that specific View which is of type NSView?
In a sub-view of my NSWindow's Content View I flip the coordinate system by subclassing NSView, placing that in my window, and in that subclassed NSView I implement method isFlipped to return YES. No idea how I could have NSWindow make it's content view out of "MyFlippedSubclassedNSView"
You can't change the internal co-ordinate system of an NSWindow. The closest you can get is to have a flipped view as the content view.
Chances are you don't actually need a flipped content view or window, though. What are you actually trying to accomplish by flipping the co-ordinate system?
No idea how I could have NSWindow make it's content view out of "MyFlippedSubclassedNSView"
Do that. Make a MyFlippedSubclassedNSView instance, and set it as the content view.
Even easier is to do it in IB: Select the window's content view, hit ⌘6 (Identity), and set the view's class to MyFlippedSubclassedNSView.
Looks like you want -[NSView setBoundsOrigin:].