I am using an IKImageBrowserView
to show a grid of images. I do not have any code that sets points or offsets or scrolls anything programmatically. I simply have code that lists the contents of a directory full of images and displays them in the image browser.
Upon launching the application, the scrolling view scrolls to the bottom of the grid of images, unprovoked. For a few seconds after this, if you try to scroll up with the mouse, the scroller glitches out and still try to scroll to the bottom. Thereafter, the issue stops and the user can scroll normally.
Prior to El Capitan, the auto-scroll was not happening.
Again, there is no code that scrolls the NSSrcollView
or set the contentOffset
, or scrollToRect
, scrollToVisibleRect
.
With that said, I have tried setting these values after the images have loaded with no success.
Question 1: Has anyone experienced this with NSScrollView
or IKImageBrowserView
on El Capitan (or possibly any Mac OS version)?
Question 2: Is there any way to debug why this is happening or how to get this to stop scrolling automatically?
Solution
This solution ended up working for me. Be sure to connect your outlets correctly.
.h
@interface WCSScrollView : NSScrollView
@end
.m
@class IKImageBrowserView;
@interface WCSScrollView ()
@property (strong) IBOutlet NSClipView * scrollerClipView;
@property (strong) IBOutlet IKImageBrowserView * imageBrowser;
@end
@implementation WCSScrollView
- (void)drawRect:(NSRect)dirtyRect {
[super drawRect:dirtyRect];
}
- (void)resizeSubviewsWithOldSize:(NSSize)oldSize {
NSClipView * clip = self.subviews[0];
self.imageBrowser = (IKImageBrowserView*)clip.subviews[0];
}
@end