Hi guys,
I'm experiencing a weird error. I was able to build a small sample that reproduces the issue. I hope you could help here. These are the steps to reproduce the problem:
- Open the attached project.
- Resize the window. Try to be exaggerated by changing the size.
The following error appears in the application console:
2017-10-30 11:43:41.946 NSScrollViewWheelExample[55949:737458] *** Assertion failure in -[NSBox _enableNeedsDisplayInRectNotifications], /BuildRoot/Library/Caches/com.apple.xbs/Sources/AppKit/AppKit-1539.12/AppKit.subproj/NSView.m:18046 2017-10-30 11:43:41.956 NSScrollViewWheelExample[55949:737458] It's not legal to call -layoutSubtreeIfNeeded on a view which is already being laid out. If you are implementing the view's -layout method, you can call -[super layout] instead. Break on void _NSDetectedLayoutRecursion(void) to debug. This will be logged only once. This may break in the future.
After getting the error the mac window is totally broken (see attached picture):
Important notes:
1. If you comment the override void ScrollWheel(NSEvent theEvent)
, the problem dissapears.
2. If you add the view to the window using ContentView = scrollView;
instead constraints, the problem dissapears.
The issue here is that I need to use constraints and also need to override the ScrollWheel event :-(
Any help would be appreciated.