Fix Save to Photos UIActivity icon being stretched
This commit is contained in:
parent
f9aee46bbe
commit
3ecee61013
|
@ -23,7 +23,14 @@ class SaveToPhotosActivity: UIActivity {
|
||||||
return "Save to Photos"
|
return "Save to Photos"
|
||||||
}
|
}
|
||||||
override var activityImage: UIImage? {
|
override var activityImage: UIImage? {
|
||||||
UIImage(systemName: "square.and.arrow.down")
|
// Just using the symbol image directly causes it to be stretched.
|
||||||
|
let symbol = UIImage(systemName: "square.and.arrow.down", withConfiguration: UIImage.SymbolConfiguration(scale: .large))!
|
||||||
|
let format = UIGraphicsImageRendererFormat()
|
||||||
|
format.scale = UIScreen.main.scale
|
||||||
|
return UIGraphicsImageRenderer(size: CGSize(width: 76, height: 76), format: format).image { ctx in
|
||||||
|
let rect = AVMakeRect(aspectRatio: symbol.size, insideRect: CGRect(x: 0, y: 0, width: 76, height: 76))
|
||||||
|
symbol.draw(in: rect)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override func canPerform(withActivityItems activityItems: [Any]) -> Bool {
|
override func canPerform(withActivityItems activityItems: [Any]) -> Bool {
|
||||||
|
|
Loading…
Reference in New Issue