UIAlertController new design on Mac OS Sonoma

The new alert on sonoma when you have 8 > actions its shows horizontal and goes out of the screen.

Is there any way to bring back the old alert?

       let alert = UIAlertController(title: "Alert", message: "Message", preferredStyle: UIAlertController.Style.alert)
        alert.addAction(UIAlertAction(title: "Click", style: UIAlertAction.Style.destructive, handler: nil))
        alert.addAction(UIAlertAction(title: "Click", style: UIAlertAction.Style.default, handler: nil))
        alert.addAction(UIAlertAction(title: "Click", style: UIAlertAction.Style.default, handler: nil))
        alert.addAction(UIAlertAction(title: "Click", style: UIAlertAction.Style.destructive, handler: nil))
        alert.addAction(UIAlertAction(title: "Click", style: UIAlertAction.Style.default, handler: nil))
        alert.addAction(UIAlertAction(title: "Click", style: UIAlertAction.Style.default, handler: nil))
        alert.addAction(UIAlertAction(title: "Click", style: UIAlertAction.Style.destructive, handler: nil))
        alert.addAction(UIAlertAction(title: "Click", style: UIAlertAction.Style.default, handler: nil))
        alert.addAction(UIAlertAction(title: "Click", style: UIAlertAction.Style.default, handler: nil))
        alert.addAction(UIAlertAction(title: "Click", style: UIAlertAction.Style.default, handler: nil))
        alert.addAction(UIAlertAction(title: "Click", style: UIAlertAction.Style.destructive, handler: nil))
        alert.addAction(UIAlertAction(title: "Click", style: UIAlertAction.Style.default, handler: nil))
        alert.addAction(UIAlertAction(title: "Click", style: UIAlertAction.Style.default, handler: nil))
        alert.addAction(UIAlertAction(title: "Click", style: UIAlertAction.Style.destructive, handler: nil))
        alert.addAction(UIAlertAction(title: "Click", style: UIAlertAction.Style.default, handler: nil))
        alert.addAction(UIAlertAction(title: "Click", style: UIAlertAction.Style.default, handler: nil))
        
        self.present(alert, animated: true, completion: nil)

Is it an iOS app ?

I tested and did not see the issue.

Please explain and eventually show screenshots.

Hi @Claude31 ,

Its iOS app running in Mac OS Sonoma Attaching screenshot:

Thanks

Sorry to say I have the same issue. No fix yet.

Hi, I had the same problem with my App since I installed Mac OS Sonoma. By chance I discovered a way to work around this... Just try: let alert = UIAlertController(title: "", message: "", preferredStyle: UIAlertController.Style.actionSheet) with a null title, message and actionSheet Style In my case this solved half of the problem at this step. The presentation is good but of course the title disappeared.

And then you can install a title with alert.setValue

Hope it helps!

Hi, I had the same problem with my App since I installed Mac OS Sonoma. By chance I discovered a way to work around this... with legal programming of course.

Just try:

let alert = UIAlertController(title: "", message: "", preferredStyle: UIAlertController.Style.actionSheet) with a null title, message and actionSheet Style In my case this solved half of the problem. The presentation is good but of course the title disappeared.

So after creating the controller you install the title, in bold font for instance and then your actions just as you do

            **let txt = NSMutableAttributedString(string: "Alert")
            let boldFont = UIFont.boldSystemFont(ofSize: 16) //for instance)
            let attributes = [NSAttributedString.Key.font: boldFont]
            alert.setValue(NSAttributedString(string: txt.string, attributes: attributes), forKey: "attributedTitle")**

Miracle for me, the result is what is expected. However It is just a workaround. There is another change with UIAlertController on Sonoma, it is no more a popoverController. I hope this will help you.

Mac OS Sonoma 14.1.2 is just released and the issue still exists. The work around I proposed remains useful.

Just came across this and surprisingly, I'm currently on Sonoma 14.6.1 and after 10 months, this issue is still not fixed.

Thanks for the workaround and it works amazingly as expected.

@claudeledu: You just saved my life!!! I have been searching for a solution to this problem for several months, to no avail. Today I just searched for "UIAlertController horizontal", and quickly came across your post (second result on Google).

Thank you so much!

As a side note, a customer 3 days ago reported that he was having this exact problem with my app, on macOS SEQUOIA.

So if it can help some developers to find it easier, I'm going to rephrase it for the search engines: this is a problem with menus displayed horizontally on macOS Sonoma and Sequoia. Menus in iOS apps are displayed horizontally on macOS Sonoma and Sequoia when they have more than 8 items. These menus on macOS Sonoma and Sequoia are horizontal, when they should be vertical. Got it, spider? :)

UIAlertController new design on Mac OS Sonoma
 
 
Q