Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS: Problem of display the popover border in the iOS13

The popover that I display is now bad displayed. There is a line missing on the arrow side. We can check that there is a little piece of black just at the end of the arrow. I think there is a view inside that is too long.

Code to display the popover:

   _popoverController = UIPopoverController(contentViewController: navController)
   _popoverController?.delegate = self

   let rect = slotCollectionView.cellForItem(at: indexPath)!.frame
   self._popoverController?.backgroundColor = UIColor.init(rgb: Int(quaternaryColorHexa))
   self._popoverController?.present (from: rect, in: self.slotCollectionView, permittedArrowDirections: UIPopoverArrowDirection.any, animated: true) 

Code to init Popover:

override func viewDidLoad()
{
    super.viewDidLoad()

    self.preferredContentSize = contentSize()
    self.navigationController!.preferredContentSize = self.preferredContentSize;

    peopleTableView.isScrollEnabled = true
    peopleTableView.bounces = true
    peopleTableView.tableFooterView = UIView(frame: CGRect(x: 0, y: 0, width: 0, height: 0))
    peopleTableView.tableFooterView?.isHidden = true
    peopleTableView.backgroundColor = UIColor.init(rgb: Int(quinquenaryColorHexa))

    self.view.backgroundColor = UIColor.init(rgb: Int(quinquenaryColorHexa))
    self.view.layer.cornerRadius = 13.0
    self.view.layer.borderWidth = 1.5
    self.view.layer.borderColor = UIColor.init(rgb: Int(quaternaryColorHexa)).cgColor 

iOS12 display:
iOS12
iOS13 display:
iOS13

like image 922
ΩlostA Avatar asked Sep 10 '19 08:09

ΩlostA


People also ask

How do I show popover in iOS?

Add a new file to the project, Select File -> New ->File and then select iOS -> Source -> Cocoa Touch Class. Name it PopoverViewController and make it a subclass of UIViewController. Go back to Main. storyboard and select the added View Controller.

What is a popover in iOS?

Typically, a popover includes an arrow pointing to the location from which it emerged. In this tutorial a popover is displayed containing a text view. This tutorial is made with Xcode 10 and built for iOS 12.

What happened to iOS 13?

When Apple released iOS 13 in 2019 — to ample fanfare — the euphoria was intense but short-lived, as the software suffered from a host of problems and stability issues. Numerous bugs plagued the initial release — so many that Apple quickly released a beta upgrade to iOS 13.1 a week ahead of schedule to tackle the worst problems.

How to fix iOS 13 6 performance issues?

While there’s no specific fix for what ails iOS 13.6, you can boost performance by doing the following to enhance battery life and prevent app problems: Open Settings. Navigate to the General section.

Does iOS 13 7 have any security patches?

While iOS 13.7 doesn’t have any security patches, if you skipped iOS 13.6 or are still using an older version of iOS, you’ll get all the security patches previously released with this upgrade. A few problems are still being reported, including issues with downloading and installing the update.


2 Answers

As mentioned in this answer it is a new feature of iOS 13 that UIPopovers include the arrows in their content views. You should use the safe area to properly react to this change.

like image 193
alexkaessner Avatar answered Sep 28 '22 03:09

alexkaessner


I think it is an iOS bug in the iOS13 version, and I advice you to do your own popover by using that git project:
DDPopoverBackgroundView

and using this for displaying the popover:

       // Popover
       _popoverController = UIPopoverController(contentViewController: navController)
       _popoverController?.delegate = self

       let rect = slotCollectionView.cellForItem(at: indexPath)!.frame

       self._popoverController!.contentSize = CGSize(width: 350, height: 600)

       self._popoverController!.backgroundViewClass = DDPopoverBackgroundView.self
       self._popoverController!.backgroundColor = UIColor.init(rgb: Int(quaternaryColorHexa)) //arrow color

       OperationQueue.main.addOperation({
           self._popoverController?.present(from: rect, in: self.slotCollectionView, permittedArrowDirections: UIPopoverArrowDirection.any, animated: true)
       })

enjoy ! ;-)

like image 32
WikeC Avatar answered Sep 28 '22 01:09

WikeC