自定义 ImageView,用于覆盖其他视图的表面,如刮刮卡,用户可以滑动覆盖物以查看下面的视图
MCScratchImageView
动图展示
Requirments
iOS 8.0+
Xcode 7.2+
Swift 4.0
Installation
CocoaPods
Manually
Just drag to the project treeMCScratchImageView.swift
Usage
Import
If you use CocoaPods, first import MCScratchImageView
Define the class variables
Initialize it
Or use StoryBoard.
Set the mask image & radius
Implement the delegate methods:
API declaration
Example Project
In "Example" folder.
Tips
- Don't set the scratchImageView.image directlly, you need to use setMaskImage(paras) to set the mask image.
- Don't set the touch point radius (var spotRadius: CGFloat) directlly.
- The contentMode should use default resize mode.
Author
Minecode, minecoder@163.com
License
MCScratchImageView is available under the MIT license. See the LICENSE file for more info.