Latest 0.1.0
Homepage https://github.com/SHCcc/SHCPhoto
License MIT
Platforms ios 8.0, requires ARC
Dependencies Kingfisher, SnapKit, SHCHUD
Authors

图片浏览器、图片选择器

功能

- 图片浏览器
    - 图片的浏览
    - 图片的放大
- 图片选择器
    - 图片的选择

使用

图片选择

  • 创建方式

    - vc: 控制器
    - maxSelected: 图片选择的最大值
    - call: 图片回调
    SHCImagePickerViewController.show(vc: UIViewController, 
                                    maxSelected: Int, 
                                    call:@escaping ((_ images:[UIImage]?)->()))

图片浏览

  • 创建方式
- vc: 控制器
- delegate: 代理
- index: 图片的数量
let vc = PhotoBrowserViewController(viewCotroller: UIViewController,
                                    delegate: PhotoBrowserViewDelegate)
vc.show(index: Int)
  • 实现代理
    
    /// 返回图片数量
    func numberOfPhotos(in photoBrowser: PhotoBrowserViewController) -> Int {
    return 图片数量
    }

/// 实现本方法以返回默认图片,缩略图或占位图
func photoBrowser(_ photoBrowser: PhotoBrowserViewController, thumbnailImageForIndex index: Int) -> UIImage? {
return 当前的图片
}

/// 实现本方法以返回默认图所在view,在转场动画完成后将会修改这个view的hidden属性
/// 比如你可返回ImageView,或整个Cell
func photoBrowser(_ photoBrowser: PhotoBrowserViewController, thumbnailViewForIndex index: Int) -> UIView? {
return 图片所在的View
}

/// 实现本方法以返回高质量图片
func photoBrowser(_ photoBrowser: PhotoBrowserViewController, highQualityImageForIndex index: Int) -> UIImage? {
return 高质量图片
}

/// 实现本方法以返回高质量图片的url
func photoBrowser(_ photoBrowser: PhotoBrowserViewController, highQualityUrlStringForIndex index: Int) -> URL? {
return 高质量图片的url
}

/// 长按时回调。可选
func photoBrowser(_ photoBrowser: PhotoBrowserViewController, didLongPressForIndex index: Int, image: UIImage) {
}

Latest podspec

{
    "name": "SHCPhoto",
    "version": "0.1.0",
    "summary": "u56feu7247u9009u62e9u548cu56feu7247u6d4fu89c8u7684u7c7b",
    "description": "u63d0u4f9bu4e86u56feu7247u6d4fu89c8u7684u653eu5927uff0cu7f29u5c0fuff0cu7b80u5355u7684u56feu7247u9009u62e9",
    "homepage": "https://github.com/SHCcc/SHCPhoto",
    "license": "MIT",
    "authors": {
        "SHCcc": "[email protected]"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source": {
        "git": "https://github.com/SHCcc/SHCPhoto.git",
        "tag": "0.1.0"
    },
    "swift_version": "4.0",
    "requires_arc": true,
    "source_files": [
        "SHCPhoto/**",
        "SHCPhoto/*/**",
        "SHCPhoto/*/*/**"
    ],
    "resource_bundles": {
        "Photo": "SHCPhoto/Photo.bundle/*.png"
    },
    "dependencies": {
        "Kingfisher": [],
        "SnapKit": [],
        "SHCHUD": []
    }
}

Pin It on Pinterest

Share This