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.
Related
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?
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
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?
I have a background image that is added to UIScrollView with zoom enabled. I am trying to add additional UIImage's on top of the background image that zoom together with the background image?
The idea is to have a background with multiple playing cards were the user can either see the whole playing field with small playing cards or zoom in the whole background including the playing cards for better views on the playing cards.
Your UIScrollview should contain a single zoomable UIView subview. That subview should contain your background UIImageView and all of the card UIImageViews as it's own subviews (if you add the background image first, it will be layered at the back of the resulting composite view)
The containing UIView that is the immediate subview of your scrollview should be the return value to the UIScrollviewDelegate method
- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView
You can manage your view hierarchy through a UIView's subviews property, which is an NSArray of views. They are layered in the order of the array, so the first view on the array will be at the back when the views are composited for display.
Well you could use the scrollviewdidzoom delegate method to notify you when the scroll view has been zoomed in and out.
From there you could do a number of things like present new UIImages at a specific zoom level using the scrollView.zoomScale property.
Let me know if this helps.
I've a UIViewController created programmatically, and when I insert its view to my general view, the 300 pixels in the bottom of the UIView aren't getting any touch event, the touch event is being caught by the superview, the main UIView.
The important fact is that only occurs when I'm on landscape mode.
Any ideas?
EDIT:
Here goes an screenshot, the oranged background is the UIView that have its own UIViewController and that needs be touched, but the as I said, the last pixels from bottom (aprox. 275) are being catched by the main UIViewController. So the buttons are never called.
Only on landscape mode!