无法在图像之间滚动
Can't scroll between images
出于某种原因,我无法在不同的照片之间滚动,有人可以发现我的错误吗?所以这是我的代码:
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 示例中执行了所有操作,但只显示了一张照片。顺便说一句,当我从 table 视图中选择单元格时正在加载此视图,然后使用 prepareForSegue
我将 5 张图像分配给 photo
并且 print(photo.count)
打印 5.
将以下代码添加到MWZoomingScrollView.m
中的函数layoutSubviews。它对我有用。
self.contentSize = CGSizeMake(floorf(self.contentSize.width), floorf(self.contentSize.height));
出于某种原因,我无法在不同的照片之间滚动,有人可以发现我的错误吗?所以这是我的代码:
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 示例中执行了所有操作,但只显示了一张照片。顺便说一句,当我从 table 视图中选择单元格时正在加载此视图,然后使用 prepareForSegue
我将 5 张图像分配给 photo
并且 print(photo.count)
打印 5.
将以下代码添加到MWZoomingScrollView.m
中的函数layoutSubviews。它对我有用。
self.contentSize = CGSizeMake(floorf(self.contentSize.width), floorf(self.contentSize.height));