-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into customDirection
- Loading branch information
Showing
12 changed files
with
77 additions
and
23 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 0 additions & 23 deletions
23
SlidableImage/Assets.xcassets/slider.imageset/Contents.json
This file was deleted.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
// | ||
// ArrowsView.swift | ||
// SlidableImage | ||
// | ||
// Created by Pawel Bednorz on 18.12.2016. | ||
// Copyright © 2016 Quver. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
|
||
class ArrowsView: UIView { | ||
|
||
override init(frame: CGRect) { | ||
super.init(frame: frame) | ||
backgroundColor = .clear | ||
} | ||
|
||
required init?(coder aDecoder: NSCoder) { | ||
super.init(coder: aDecoder) | ||
backgroundColor = .clear | ||
} | ||
|
||
override func draw(_ rect: CGRect) { | ||
drawCircle(rect) | ||
drawArrows(rect) | ||
} | ||
|
||
private func drawCircle(_ rect: CGRect) { | ||
let circle = UIBezierPath(ovalIn: rect) | ||
let circleLayer = CAShapeLayer() | ||
circleLayer.path = circle.cgPath | ||
circleLayer.fillColor = UIColor.lightGray.cgColor | ||
circleLayer.shadowColor = UIColor.darkGray.cgColor | ||
circleLayer.shadowOpacity = 1 | ||
circleLayer.shadowOffset = CGSize.zero | ||
circleLayer.shadowRadius = 10 | ||
layer.addSublayer(circleLayer) | ||
} | ||
|
||
private func drawArrows(_ rect: CGRect) { | ||
let factor: CGFloat = rect.width * 0.05 | ||
|
||
let startPointLeft = CGPoint(x: (rect.minX + 2 * factor), y: rect.midY) | ||
let arrowLeft = UIBezierPath() | ||
arrowLeft.move(to: startPointLeft) | ||
arrowLeft.addLine(to: CGPoint(x: (rect.midX - factor), y: rect.minY + 2 * factor)) | ||
arrowLeft.addLine(to: CGPoint(x: (rect.midX - factor), y: rect.maxY - 2 * factor)) | ||
arrowLeft.addLine(to: startPointLeft) | ||
|
||
let arrowLeftLayer = CAShapeLayer() | ||
arrowLeftLayer.path = arrowLeft.cgPath | ||
arrowLeftLayer.fillColor = UIColor.white.cgColor | ||
layer.addSublayer(arrowLeftLayer) | ||
|
||
let startPointRight = CGPoint(x: (rect.maxX - 2 * factor), y: rect.midY) | ||
let arrowRight = UIBezierPath() | ||
arrowRight.move(to: startPointRight) | ||
arrowRight.addLine(to: CGPoint(x: (rect.midX + factor), y: rect.minY + 2 * factor)) | ||
arrowRight.addLine(to: CGPoint(x: (rect.midX + factor), y: rect.maxY - 2 * factor)) | ||
arrowRight.addLine(to: startPointRight) | ||
|
||
let arrowRightLayer = CAShapeLayer() | ||
arrowRightLayer.path = arrowRight.cgPath | ||
arrowRightLayer.fillColor = UIColor.white.cgColor | ||
layer.addSublayer(arrowRightLayer) | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters