0

由于某种原因,我无法在不同的照片之间滚动,有人能发现我的错误吗?所以这是我的代码:

import UIKit
import MWPhotoBrowser

class TETSViewController: MWPhotoBrowser, MWPhotoBrowserDelegate {

    var photo = [MWPhoto]()

    override func viewDidLoad() {
        super.viewDidLoad()

        displayActionButton = false
        displaySelectionButtons = false
        displayNavArrows = false
        enableGrid = false
        startOnGrid = false
        autoPlayOnAppear = false
        zoomPhotosToFill = true
        enableSwipeToDismiss = false
        setCurrentPhotoIndex(0)
    }

    func numberOfPhotosInPhotoBrowser(photoBrowser: MWPhotoBrowser!) -> UInt {
        return UInt(photo.count)
    }

    override func photoAtIndex(index: UInt) -> MWPhotoProtocol! {
        if index < UInt(photo.count) {
            return photo[Int(index)]
        } else {
            return nil
        }
    }

    func photoBrowser(photoBrowser: MWPhotoBrowser!, photoAtIndex index: UInt) -> MWPhotoProtocol! {
        if index < UInt(photo.count) {
            return photo[Int(index)]
        } else {
            return nil
        }
    }
}

我想我在官方 MWPhotoBrowser 示例中做了所有事情,但只显示了一张照片。顺便说一句,当我从表格视图中选择单元格时正在加载此视图,然后使用prepareForSegue我分配 5 个图像photoprint(photo.count)打印 5 个。

4

1 回答 1

1

将以下代码添加到MWZoomingScrollView.m. 这个对我有用。

self.contentSize = CGSizeMake(floorf(self.contentSize.width), floorf(self.contentSize.height));

请参阅https://github.com/mwaterfall/MWPhotoBrowser/issues/389

于 2016-05-12T06:35:18.740 回答