Re: NSAlert replacement on Big Sur


Alex Zavatone
 

Nice find.

You could fork it and add those changes if you wanted to (or had the time to) and feature it on your GitHub account.

Cheers,
Alex Zavatone

On Aug 11, 2021, at 2:08 AM, Leo <leo.r@...> wrote:

If you dislike the redesigned NSAlert on  Big Sur as much as I do (as well as countless other users and developers), then I recently found a github project for a much better replacement.

Here's a brief example:
<pac-alerts-bs-vs-new.png>
As you can see, it restores the human-oriented design and layout of pre-Big Sur systems.

The original project is here:

https://github.com/TroikaTronix/NSCustomAlert

It does require some changes to work properly:

Mainly, to make the window moveable, do the following in the -init method in NSCustomAlert.mm:
• Remove the NSWindowStyleMaskDocModalWindow mask
• add _panel.movableByWindowBackground = YES
 
Also, you'll need to change the font from Helvetica to systemFont... and adjust font sizes as needed. Once it's done it works perfectly.

Another small change:

In [self expandButtonSize:btn expandHorz:10.0f minWidth:75.0f] change 75 to 96 to make sure OK button is the same size as Cancel

I'm not sure that the developer still maintains the project. I left a feedback but he never responded.

I'm gradually replacing all alerts in my apps with this custom alert. I already had my own category of NSAlert so it was easy to add this class in a single place.


Note:

These two files from the entire project are sufficient to display the alert: NSCustomAlert.h and NSCustomAlert.mm. I'm not using any other files.  

The project doesn't support the "don't show again button" - but I never used it anyway.


Hope it's useful - if you have any questions let me know.

Leo

Join xcode@apple-dev.groups.io to automatically receive all group messages.