UIPopOverPresentationController

UIPopOverViewController in swift is writen in swift 3.1 and Use the xcode Version 8.3.2.
For use this import the PopOverViewController folder into your project.
For using this file create the instance of PopOverViewC class and inherit the UIPopoverPresentationControllerDelegate :

  var itemPopVC = PopOverViewC()

Add below line of code in your Tapable button function for set the properties of UIPopOverViewController, change the properties

self.itemPopVC.modalPresentationStyle = .popover
self.itemPopVC.popoverPresentationController?.barButtonItem = self.navigationItem.rightBarButtonItem
self.itemPopVC.popoverPresentationController?.permittedArrowDirections = .unknown
self.itemPopVC.popoverPresentationController?.delegate = self
self.itemPopVC.popoverPresentationController?.backgroundColor = UIColor.red
self.itemPopVC.popoverPresentationController?.popoverLayoutMargins = UIEdgeInsets.init(top: 50.0, left: 100.0, bottom: 0.0, right: 0.0)
self.present(self.itemPopVC, animated: true, completion: { _ in })

self.itemPopVC.popoverPresentationController?.barButtonItem in this pass the tapable bar button, and there is sourceRect also in which
we pass the rect of any button.

For Get the didSelectCell call back add the notification and add these functions:

func tableDidSelected(_ notification: Notification)
  {
    var indexpath: IndexPath? = (notification.object as? IndexPath)
    self.itemPopVC.dismiss(animated: true, completion: { _ in })
  }
  
  
  func popoverPresentationControllerShouldDismissPopover(_ popoverPresentationController: UIPopoverPresentationController) -> Bool
  {
    return true
  }
  
  func adaptivePresentationStyle(for controller: UIPresentationController) -> UIModalPresentationStyle
  {
    return UIModalPresentationStyle.none
  }

Related Post

Custom View by use of xib in swift Custom View by use of xib in swift We can create the custom and common view by the use of xib in swift 3.1 and XCode 8.3.2 . Custom views are common ...
Comments in C Comments in C Comments in C language are used to provide information about lines of code. It is widely used for documenting code. There are 2 types o...
Introduction To C A Brief History Of C   C was invented and first implemented by Dennis Ritchie on a DEC PDP-11 that used the Unix operating system. C is the r...
Use of CollectionViewDataSource method moveItemAt ... Use of CollectionViewDataSource method moveItemAt for Reordering CollectionView cell In IOS (Swift 4) In this tutorial we are study about how we can r...
Firebase Push notification | Swift tutorial Push Notification by firebase in IOS.For Firebase Push notification we need to have paid apple developer account. You need to Enroll into the App...
Drag and Drop Collection View cell in IOS 11 &... Drag and Drop Collection View cell in IOS 11 & swift 4 In this tutorial we are explain how to drag and drop collection view cell in two collectio...
Author

Write A Comment