Open aloveric opened 5 years ago
this is my snippet: `let remotePDFDocumentURLPath = item.url let remotePDFDocumentURL = URL(string: remotePDFDocumentURLPath!)! let document = PDFDocument(url: remotePDFDocumentURL)!
let readerController = PDFViewController.createNew(with: document) let modalReaderController: PDFReaderViewController = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "pdfreadercontroller") as! PDFReaderViewController present(modalReaderController, animated: true, completion: nil) modalReaderController.containerView.addSubview(readerController.view) modalReaderController.addChildViewController(readerController) readerController.view.translatesAutoresizingMaskIntoConstraints = false let top = NSLayoutConstraint(item: readerController.view, attribute: .top, relatedBy: .equal, toItem: modalReaderController.containerView, attribute: .top, multiplier: 1, constant: 0) let bottom = NSLayoutConstraint(item: readerController.view, attribute: .bottom, relatedBy: .equal, toItem: modalReaderController.containerView, attribute: .bottom, multiplier: 1, constant: 0) let leading = NSLayoutConstraint(item: readerController.view, attribute: .leading, relatedBy: .equal, toItem: modalReaderController.containerView, attribute: .leading, multiplier: 1, constant: 0) let trailing = NSLayoutConstraint(item: readerController.view, attribute: .trailing, relatedBy: .equal, toItem: modalReaderController.containerView, attribute: .trailing, multiplier: 1, constant: 0) modalReaderController.containerView.addConstraints([top, bottom, leading, trailing])`
@Y2JChamp Thanks~~
this is my snippet: `let remotePDFDocumentURLPath = item.url let remotePDFDocumentURL = URL(string: remotePDFDocumentURLPath!)! let document = PDFDocument(url: remotePDFDocumentURL)!