Skip to content

Commit

Permalink
Merge pull request #2 from myxplor/fea/5462_remove_deprecated_api_2
Browse files Browse the repository at this point in the history
5462 added in changes with the updated UIGraphicsImageRenderer
  • Loading branch information
joseph7711 authored Jul 19, 2023
2 parents dc69b3d + daa0a6b commit 2fad09d
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions DropDown/src/DropDown.swift
Original file line number Diff line number Diff line change
Expand Up @@ -84,17 +84,19 @@ public final class DropDown: UIView {
fileprivate let tableView = UITableView()
fileprivate var templateCell: DropDownCell!
fileprivate lazy var arrowIndication: UIImageView = {
UIGraphicsBeginImageContextWithOptions(CGSize(width: 20, height: 10), false, 0)
let path = UIBezierPath()
path.move(to: CGPoint(x: 0, y: 10))
path.addLine(to: CGPoint(x: 20, y: 10))
path.addLine(to: CGPoint(x: 10, y: 0))
path.addLine(to: CGPoint(x: 0, y: 10))
UIColor.black.setFill()
path.fill()
let img = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
let tintImg = img?.withRenderingMode(.alwaysTemplate)

let renderer = UIGraphicsImageRenderer(size: CGSize(width: 20, height: 10))
let img = renderer.image { _ in
let path = UIBezierPath()
path.move(to: CGPoint(x: 0, y: 10))
path.addLine(to: CGPoint(x: 20, y: 10))
path.addLine(to: CGPoint(x: 10, y: 0))
path.addLine(to: CGPoint(x: 0, y: 10))
UIColor.black.setFill()
path.fill()
}

let tintImg = img.withRenderingMode(.alwaysTemplate)
let imgv = UIImageView(image: tintImg)
imgv.frame = CGRect(x: 0, y: -10, width: 15, height: 10)
return imgv
Expand Down

0 comments on commit 2fad09d

Please sign in to comment.