You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
code does not work when using iPad with the UIkit.
Thread 1: “UIPopoverPresentationController (<UIPopoverPresentationController: 0x147d52ff0>) should have a non-nil sourceView or barButtonItem set before the presentation occurs.”
thanks.
The text was updated successfully, but these errors were encountered:
HI , which part of the code u use with a UIPopoverPresentationController to present?
Are you talking about you're using a UIHostingController to wrap the SwiftUI views and then to be presented by a UIPopoverPresentationController ? Btw, this is not anything involves the SwiftUI codes, I think you should look into your own code how you implement a UIPopoverPresentationController ,
Commonly, a UIPopoverPresentationController is presented with the following codes :
let contentView = ContentView() // contentView is a swiftUI view
let vc = UIHostingController(rootView : contentView)
vc.preferredContentSize = CGSize(width: 300, height: 300)
vc.modalPresentationStyle = .popover
if let popover: UIPopoverPresentationController = vc.popoverPresentationController{
popover.delegate = self
popover.sourceView = self.view
popover.barButtonItem = myBarButtonItem // your bar button item created somewhere else
present(vc, animated: true, completion:nil)
}
code does not work when using iPad with the UIkit.
Thread 1: “UIPopoverPresentationController (<UIPopoverPresentationController: 0x147d52ff0>) should have a non-nil sourceView or barButtonItem set before the presentation occurs.”
thanks.
The text was updated successfully, but these errors were encountered: