ios - 如何像UITableview数据源一样返回 View 数(ZLSwipeableViewSwif)?

标签 ios swift uitableview

我正在尝试实现,我无法设置 View 数量,我只想设置五个 View ,在 View 加载之前我需要使用哪个属性。 图书馆链接enter link description here

self.swipeableView.numberOfActiveView = 5;
self.swipeableView.discardViews()
self.swipeableView.loadViews()

我正在尝试使用他们的演示应用程序。

最佳答案

您可以将颜色数组替换为其他数组,例如,

在该颜色数组下面再声明一个数组,

var imgArray = ["1","2","3","4"]

现在从已加载的 View 中找到颜色数组并将其替换为 imgArray,

swipeableView.nextView = {
        if self.colorIndex < self.imgArray.count //self.colors.count
        {
            var cardFrame = CGRectMake(self.swipeableView.frame.origin.x, 0, self.swipeableView.frame.size.width, 250)
            var cardView = CardView(frame: cardFrame)
            var img : UIImageView = UIImageView(frame: cardView.bounds)
            img.image = UIImage(named: self.imgArray[self.colorIndex])
            cardView.addSubview(img)
            self.colorIndex++

            ....
            ....

        }

这在我这边工作得很好,希望这对你有帮助。

关于ios - 如何像UITableview数据源一样返回 View 数(ZLSwipeableViewSwif)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37915355/

相关文章:

swift - 如何在一个 View Controller 中使用多个 UIPickerView

swift - UITableViewCell 中的 UIButton 无法点击

ios - uitableview 中的异步图像加载

ios - WatchKit 扩展配置文件?

ios - 用quartz2d绘图时如何将矩形夹在圆周围?

ios - 如何跟踪某些 iPhone 设备 ID 以防止重新安装

ios - iOS 云后端事件监听通论

swift - 传递选中单元格的标签文本,第一次返回nil(数据发送延迟)

ios - iOS 应用程序的有效 UI 样式

ios - 无法通过setHidden隐藏UIImageView: