如何在ViewDidLoad上显示FullScreenSlideshowViewController

我是iOS开发的新手,我创建了Android应用程序,其中app从url获取图像集(有时超过100个图像),并使用zoomEnabled在ViewPager中加载到imageView中。

现在我想为iOS创建相同的应用程序,我找到了这个lib ImageSliderShow 。 问题是它仅在用户点击所选图像时才显示全屏。 我一直在努力在viewDidLoad上没有锁定地presentFullScreenController

我只希望图像以fullScreen显示,例如:

从CategoryVC中选择A类 – >加载ImageSlideVC,从服务器获取图像集,在FullScreenView中显示。

我怎样才能做到这一点? 添加这个:

 slideshow.presentFullScreenController(from: self) 

viewDidLoad上不起作用:

 @IBOutlet var slideshow: ImageSlideshow! let kingfisherSource = [KingfisherSource(urlString: "https://images.unsplash.com/photo-1447746249824-4be4e1b76d66?w=1080")!, KingfisherSource(urlString: "https://images.unsplash.com/photo-1447746249824-4be4e1b76d66?w=1080")!, KingfisherSource(urlString: "https://images.unsplash.com/photo-1463595373836-6e0b0a8ee322?w=1080")!] override func viewDidLoad() { super.viewDidLoad() slideshow.setImageInputs(kingfisherSource) slideshow.presentFullScreenController(from: self) } 

我没有得到任何错误,输出与以前相同(在小视图中显示幻灯片,没有缩放)

请帮忙

编辑

通过在viewDidAppear中执行,在拆分第二个视图后将其加载到全屏中。 首先,它的小视图然后全屏显示。 我想我必须在setImageInputs中做一些事情

这是它的样子:

  open func setImageInputs(_ inputs: [InputSource]) { self.images = inputs self.pageControl.numberOfPages = inputs.count // in circular mode we add dummy first and last image to enable smooth scrolling if circular && images.count > 1 { var scImages = [InputSource]() if let last = images.last { scImages.append(last) } scImages += images if let first = images.first { scImages.append(first) } self.scrollViewImages = scImages } else { self.scrollViewImages = images } reloadScrollView() layoutScrollView() layoutPageControl() setTimerIfNeeded() } 

尝试在viewDidAppear执行此操作

 @IBOutlet var slideshow: ImageSlideshow! override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) slideshow.setImageInputs(kingfisherSource) slideshow.presentFullScreenController(from: self) } 

在ViewDidLoad中呈现viewController是一种不好的做法。