Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hlts2/uiholeview
Custom UIView that creates holes into the view
https://github.com/hlts2/uiholeview
custom-view hlts2 hole hole-view ios ios-component swift swift-library ui-components ui-library uiholeview uiview
Last synced: about 6 hours ago
JSON representation
Custom UIView that creates holes into the view
- Host: GitHub
- URL: https://github.com/hlts2/uiholeview
- Owner: hlts2
- License: mit
- Created: 2018-09-21T11:14:28.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-09-23T07:13:44.000Z (over 6 years ago)
- Last Synced: 2024-11-19T06:39:54.129Z (2 months ago)
- Topics: custom-view, hlts2, hole, hole-view, ios, ios-component, swift, swift-library, ui-components, ui-library, uiholeview, uiview
- Language: Swift
- Homepage:
- Size: 83 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# UIHoleView
UIHoleView is the custom UIView that creates holes.
## Installation
### [Carthage](https://github.com/Carthage/Carthage)
1. Add this line to your Cartfile: `github "hlts2/UIHoleView"`
2. Read the [official instruction](https://github.com/Carthage/Carthage#adding-frameworks-to-an-application)## Usage
1. imports the `UIHoleView` package
```swift
import UIHoleView
```2. creates hole and custom view
```swift
// defines hole type. this example code is square hole.
let hole = Hole(path: UIBezierPath(rect: CGRect(x: 0, y: 0, width: 200, height: 200)),
color: UIColor.clear,
drawer: DrawSquareHole())let holeView = UIHoleView(frame: self.view.bounds) // or let holeView = UIHoleView(holes: [hole])
// sets holes
holeView.setHoles([hole])// sets background color outside holes
holeView.backgroundColor = UIColor.black.withAlphaComponent(0.5)// adds holeview into self.view
self.view.addSubview(self.holeView)
```## Hole type
- Square Hole
```swift
let hole = Hole(path: UIBezierPath(rect: CGRect(x: 0, y: 0, width: 200, height: 200)),
color: UIColor.clear,
drawer: DrawSquareHole())
```- Circule Hole
```swift
let hole = Hole(path: UIBezierPath(rect: CGRect(x: 0, y: 0, width: 200, height: 200)),
color: UIColor.clear,
drawer: DrawCircleHole())
```- Rounded Corner Hole
```swift
let hole = Hole(path: UIBezierPath(roundedRect: CGRect(x: 0, y: 0, width: 200, height: 200), cornerRadius: 10),
color: UIColor.clear,
drawer: DrawRoundedCornerHole())
```## License
UIHoleView is released under the MIT license. Go read the LICENSE file for more information.