I'm encountering an issue where the same code for creating a UIBarButtonItem results in different visual appearances between iOS 18 (or earlier) and iOS 26 Beta 4. I'm testing on simulators and devices using Xcode 26 beta 4.
In my app, I'm setting a right bar button item in a view controller's navigation bar with the following code:
func initView() {
self.view.backgroundColor = .systemGray6
self.title = "Title"
self.preferredContentSize = CGSize(width: 500, height: 600)
let cancelButton = UIBarButtonItem.init(title: "Close", style: .plain, target: self, action: #selector(cancelAndBack))
self.navigationItem.leftBarButtonItem = cancelButton
if #available(iOS 26.0, *) {
let doneButton = UIBarButtonItem.init(title: "Done", style: .prominent, target: self, action: #selector(cancelAndBack))
self.navigationItem.rightBarButtonItem = doneButton
} else {
let doneButton = UIBarButtonItem.init(title: "Done", style: .done, target: self, action: #selector(cancelAndBack))
self.navigationItem.rightBarButtonItem = doneButton
}
}
For Cancel Button:
- No explicit style is set here, so it defaults to .plain.
- On iOS 18 and below, this appears as plain text without a background or rounded frame, which is the desired look.
- On iOS 26 Beta 4, it shows with a white background and rounded corners, which I don't want. I need a clear background without any rounding or frame.
For Done Button:
- I noticed that UIBarButtonItem.Style.done is deprecated in iOS 26 (as per documentation). So, I tried using .prominent explicitly, but the appearance is different ion IOS 26 in compared to iOS 18.
- it is added system blue color as the background color of the button.
Question: Is there a recommended way to achieve consistent appearance across iOS 18 and iOS 26, specifically retaining the iOS 18 style (plain text, no background, no rounding) on iOS 26 devices? Are there any new APIs or configuration options in iOS 18 that I should use to override this default styling? Or is this a beta issue that might be resolved?
Fully Code:
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Create the button
let button = UIButton(type: .system)
button.setTitle("Click me", for: .normal)
button.translatesAutoresizingMaskIntoConstraints = false
button.titleLabel?.font = UIFont.systemFont(ofSize: 18)
button.setTitleColor(.white, for: .normal)
button.backgroundColor = .systemBlue
button.layer.cornerRadius = 8
// Add target for button tap
button.addTarget(self, action: #selector(buttonTapped), for: .touchUpInside)
// Add button to view
view.addSubview(button)
// Set up constraints to center the button
NSLayoutConstraint.activate([
button.centerXAnchor.constraint(equalTo: view.centerXAnchor),
button.centerYAnchor.constraint(equalTo: view.centerYAnchor)
])
}
@objc func buttonTapped() {
let exportViewController = ExportViewController()
let navController = UINavigationController(rootViewController: exportViewController)
navController.modalPresentationStyle = .formSheet
self.present(navController, animated: true, completion: nil)
}
}
import UIKit
class ExportViewController: UIViewController {
func initView() {
self.view.backgroundColor = .systemGray6
self.title = "Title"
self.preferredContentSize = CGSize(width: 500, height: 600)
let cancelButton = UIBarButtonItem.init(title: "Close", style: .plain, target: self, action: #selector(cancelAndBack))
self.navigationItem.leftBarButtonItem = cancelButton
if #available(iOS 26.0, *) {
let doneButton = UIBarButtonItem.init(title: "Done", style: .prominent, target: self, action: #selector(cancelAndBack))
self.navigationItem.rightBarButtonItem = doneButton
} else {
let doneButton = UIBarButtonItem.init(title: "Done", style: .done, target: self, action: #selector(cancelAndBack))
self.navigationItem.rightBarButtonItem = doneButton
}
}
override func viewDidLoad() {
super.viewDidLoad()
// Call initView first to set up the basic view
initView()
// Create and add the label
let helloLabel = UILabel()
if #available(iOS 26.0, *) {
helloLabel.text = "Hello iOS 26"
} else {
helloLabel.text = "Hello iOS 18"
}
helloLabel.font = UIFont.systemFont(ofSize: 48)
helloLabel.textAlignment = .center
helloLabel.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(helloLabel)
// Center the label in the view
NSLayoutConstraint.activate([
helloLabel.centerXAnchor.constraint(equalTo: view.centerXAnchor),
helloLabel.centerYAnchor.constraint(equalTo: view.centerYAnchor)
])
}
@objc func cancelAndBack(){
self.dismiss(animated: true, completion: nil)
}
}
Please, refer attached screenshot for button appearance .

