PuzzleMaker 1.2.1

PuzzleMaker 1.2.1

测试已测试
Lang语言 SwiftSwift
许可 MIT
发布上次发布2019年4月
SPM支持 SPM

Paweł KaniaPawel KaniaMichał Myśliwiec 维护。



  • 作者:
  • Paweł Kania

pgssoft-logo.png

PuzzleMaker

PuzzleMaker 是一个用 Swift 编写的库,可以从图像动态生成一系列拼图。

Swift 5.0 Travis CocoaPods Compatible Carthage Compatible Platform License

PuzzleMaker.gif

安装

最方便的方式是通过 Podfile 使用 Cocoapods

pod 'PuzzleMaker'

或者使用 Carthage 并在 Cartfile 中添加一行

github "PGSSoft/PuzzleMaker"

要求

iOS 8.4

用法

import PuzzleMaker
let puzzleMaker = PuzzleMaker(image: UIImage(named: "image")!, numRows: ViewController.numRows, numColumns: ViewController.numColumns)
        puzzleMaker.generatePuzzles { throwableClosure in
            do {
                let puzzleElements = try throwableClosure()
                for row in 0 ..< ViewController.numRows {
                    for column in 0 ..< ViewController.numColumns {
                        guard let puzzleElement = puzzleElements[row][column] else { continue }
                        let position = puzzleElement.position
                        let image = puzzleElement.image
                        let imgView = UIImageView(frame: CGRect(x: position.x, y: position.y, width: image.size.width, height: image.size.height))
                        imgView.image = image
                        self.view.addSubview(imgView)
                    }
                }

            } catch {
                debugPrint(error)
            }
	}
}

贡献

欢迎在GitHub上为我们提交错误报告和pull请求:[https://github.com/PGSSoft/PuzzleMaker](https://github.com/PGSSoft/PuzzleMaker)。

许可

本项目遵守MIT许可证的条款提供开源。

关于

本项目由软件开发公司PGS Software维护。查看我们的其他开源项目,或联系我们开发您的产品。

关注我们

Twitter URL
Twitter Follow