Fix double nav controller in share extension

This commit is contained in:
Shadowfacts 2023-05-04 10:01:32 -04:00
parent ad55851090
commit 3c13d2083b
1 changed files with 8 additions and 9 deletions

View File

@ -33,17 +33,16 @@ class ShareViewController: UIViewController {
let context = ShareMastodonContext(accountInfo: account)
let host = ShareHostingController(draft: draft, mastodonContext: context)
let nav = UINavigationController(rootViewController: host)
self.addChild(nav)
nav.view.translatesAutoresizingMaskIntoConstraints = false
self.view.addSubview(nav.view)
host.view.translatesAutoresizingMaskIntoConstraints = false
addChild(host)
self.view.addSubview(host.view)
NSLayoutConstraint.activate([
nav.view.leadingAnchor.constraint(equalTo: self.view.leadingAnchor),
nav.view.trailingAnchor.constraint(equalTo: self.view.trailingAnchor),
nav.view.topAnchor.constraint(equalTo: self.view.topAnchor),
nav.view.bottomAnchor.constraint(equalTo: self.view.bottomAnchor),
host.view.leadingAnchor.constraint(equalTo: self.view.leadingAnchor),
host.view.trailingAnchor.constraint(equalTo: self.view.trailingAnchor),
host.view.topAnchor.constraint(equalTo: self.view.topAnchor),
host.view.bottomAnchor.constraint(equalTo: self.view.bottomAnchor),
])
nav.didMove(toParent: self)
host.didMove(toParent: self)
}
} else {
state = .notLoggedIn