Я хочу скрыть строку статуса только для представленного ViewController. Проблема, когда появляется представленное представление, сначала кажется, что в навигационном боре есть дополнительное пространство, которое необходимо исправить. Вращение и назад он решает и выглядит хорошо. 2 -й вопрос заключается в том, когда мы уволимся с ViewController, и строка состояния перекрывается с навигационной строкой.import UIKit
class ParentViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
self.navigationItem.leftBarButtonItem = UIBarButtonItem(title: "Left", style: .plain, target: nil, action: nil)
self.navigationItem.rightBarButtonItem = UIBarButtonItem(title: "Right", style: .plain, target: nil, action: nil)
self.navigationController?.navigationBar.backgroundColor = .orange
let ubtton = UIButton()
ubtton.frame = self.view.bounds
ubtton.setTitle("PRESENT", for: .normal)
ubtton.setTitleColor(.gray, for: .normal)
ubtton.addTarget(self, action: #selector(showTestController), for: .touchUpInside)
self.view.addSubview(ubtton)
}
@objc
func showTestController() {
let viewController = PresentedViewController()
viewController.modalPresentationStyle = .fullScreen
let navigationController = UINavigationController(rootViewController: viewController)
navigationController.modalPresentationStyle = .fullScreen
self.present(navigationController, animated: true)
}
}
< /code>
presentedviewcontroller.swift
import UIKit
class PresentedViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
self.view.backgroundColor = .red
// Do any additional setup after loading the view.
self.navigationItem.rightBarButtonItem = UIBarButtonItem(title: "Close", style: .plain, target: self, action: #selector(close))
}
@objc func close() {
self.dismiss(animated: true)
}
override var prefersStatusBarHidden: Bool {
return true
}
}
< /code>
В iPados 18 он работает правильно, но проблема только что появляется в iPados 26. В iPhone он работает правильно. src = "https://i.sstatic.net/gwdwvmbi.png"/>
Подробнее здесь: https://stackoverflow.com/questions/797 ... ter-presen
Xcode 26 (бета 6), iPados 26: Столбная строка перекрывается с помощью навигационной панели после представления ViewContr ⇐ IOS
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение