gpt4 book ai didi

ios - 带有全屏 slider 的 Swift 图片库

转载 作者:行者123 更新时间:2023-11-29 02:08:19 26 4
gpt4 key购买 nike

我想建立一个类似 facebook 的图片库,但不知道从哪里开始。这是我认为我应该做的:

  • 基于数组显示缩略图的 CollectionView
  • 在行单击时,我基于相同的图像数组以模态方式打开 pageViewController
  • 在左右滑动时,我转到下一张或上一张图片
  • 在上下滑动时,我关闭此 View 并返回到我的收藏 View

这个逻辑是否正确/最佳实践?也许有人已经这样做了。

最佳答案

您可以使用香蕉库在 Swift 中的 slider View 中显示图像

https://github.com/gauravkatoch007/banana获取香蕉

import banana

@IBOutlet weak var imageScrollView: UIScrollView!

// Here imageArray can be a string array of Image URLs
var imageArray = [String]()

//or imageArray can be a array of UIImages
var imageArray = [UIImage]()

var imageScroll = banana( imageScrollView :self.imageScrollView )
//Load to load images in memory and display them in User Interface
imageScroll!.load(imageArray)

//Call startScroll for autoScrolling. Default scrolling timer is 8 seconds
imageScroll!.startScroll()


//Call this function to stop autoScrolling on touch or swipe.
imageScroll!.assignTouchGesture()

关于ios - 带有全屏 slider 的 Swift 图片库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29555845/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com