簡體   English   中英

如何在Swift中顯示帶有UICollectionView的彈出式UIViewController?

[英]How to show a pop up UIViewController with a UICollectionView in it in Swift?

如果我從情節提要中啟動,帶有UICollectionView的UIViewController可以正常工作。 但是,當我嘗試像這樣啟動它時:

let imagePicker = imagePickerControllerViewController()
imagePicker.modalPresentationStyle = .OverCurrentContext
presentViewController(imagePicker, animated: true, completion: nil)

它崩潰在線:

collectionView.dataSource = self

問題是,如何正確顯示模態顯示的UIViewController(具有UICollectionView)?

替換為:

let imagePicker = imagePickerControllerViewController()

附:

let imagePicker = storyboard.instantiateViewControllerWithIdentifier("imagePicker") as! imagePickerControllerViewController

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM