Post

Replies

Boosts

Views

Activity

Reply to Debug an issue with NSWindow becoming narrow
Create an NSWindow subclass for the window this happens with. Override setMinSize and put a breakpoint there? At least will tell you if it is constraints related or not. You could also check to see if you do anything in your window.setScreen method (or didSet if using Swift). How about NSWindow.didChangeScreenNotification? I guess there's a bunch of potential notifications that could be called when changing screens. didChangeScreenProfileNotification, didUpdateNotification, didChangeBackingPropertiesNotification..
Topic: UI Frameworks SubTopic: AppKit Tags:
4w
Reply to UIDeferredMenuElement With Uncached Provider Not Working on Mac Catalyst. Uncached provider block never called and menu displays as "Loading"
I ran into this issue recently and found a workaround to this. Don't attach the menu to the bar button item. Instead use a UIButton as the custom view (sorry about the bastardized ObjC code): let optionsButton = [UIButton buttonWithType:UIButtonTypeCustom]; [optionsButton setImage:optionsImage forState:UIControlStateNormal]; optionsButton.showsMenuAsPrimaryAction = YES; optionsButton.menu = menu; optionsBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:optionsButton]; I want to saw if I changed the button type to .system then I got the same 'Loading...' menu item forever. But when it is custom seems to work. Of course now the bar button item behaves a little differently when the window isn't active so you'll have to write code to tint it to look inactive as needed. But hey the menu works.
Topic: UI Frameworks SubTopic: UIKit Tags:
Jul ’24
Reply to Mac Catalyst Menu Bar/Toolbar Actions Not Validating Properly After Changing Active Windows
Nice fix. In my case I used some appkit code to create the toolbar item view instead of using UIView. It would be far nicer though if I could just use a subclass of UIView again. I just tested my sample app on Sonoma/Xcode 15 and it looks like they fixed the bug. Would be nice if there were actual release notes for Mac Catalyst code. Will experiment with your fix in my app. Thanks for posting it.
Topic: UI Frameworks SubTopic: UIKit Tags:
Nov ’23
Reply to Strange vertical alignment in Catalyst navigation bar titles in modal sheets w/Catalyst & macOS Sonoma
You likely need create a UIBarButtonItemAppearance and adjust the titlePositionAdjustment property then set navigationBarAppearance.buttonAppearance = buttonItemAppearance. Same for navigationBarAppearance.doneButtonAppearance and navigationBarAppearance.backButtonAppearance. For the back button I had to multiply the vertical value by -1.0 to get it to be the same as the other properties. Then lastly had to apply the full appearance to the navigation bar: navigationBar.standardAppearance = navigationBarAppearance navigationBar.scrollEdgeAppearance = navigationBarAppearance
Topic: UI Frameworks SubTopic: UIKit Tags:
Nov ’23
Reply to Mac Catalyst Menu Bar/Toolbar Actions Not Validating Properly After Changing Active Windows
Seems like there's definitely some bugs in there when switching windows/window scenes. I'm just trying debug something that I bet is related to this (UITextView loses its focus when you click on another window and then back to the original window again). I've also seen oddness when a window looks like it is active but menu items aren't enabled that should be.
Topic: UI Frameworks SubTopic: UIKit Tags:
May ’23
Reply to Handling Mouse Scroll Wheel events using UIPanGestureRecognizer
Here's some code I'm using. I grabbed it from somewhere and didn't make note of where it came from. UIPanGestureRecognizer *scrollWheelGesture = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handleScrollWheelGesture:)]; scrollWheelGesture.allowedScrollTypesMask = UIScrollTypeMaskDiscrete; // only accept scroll-wheel, not track-pad scrollWheelGesture.maximumNumberOfTouches = 0; (void)handleScrollWheelGesture:(UIPanGestureRecognizer *)pan { CGPoint delta = [pan translationInView:self.view]; // delta.y will be negative if scrolling up and positive if down I think..
Topic: App & System Services SubTopic: General Tags:
May ’23
Reply to Mac Catalyst and NSToolbar
I've also seen this bug. My workaround (as annoying as it is) is to create my own NSToolbar and items and enable and disable them myself as needed. Seems like the only workaround until the Catalyst devs improve the interaction between navitems and toolbaritems.
May ’23