diff --git a/deltachat-ios/Extensions/Extensions.swift b/deltachat-ios/Extensions/Extensions.swift index 4602d2328..8dd414426 100644 --- a/deltachat-ios/Extensions/Extensions.swift +++ b/deltachat-ios/Extensions/Extensions.swift @@ -114,6 +114,23 @@ extension UILabel { } } +extension UIButton { + func fixImageAndTitleSpacing() { + let spacing = 6.0 + let insetAmount = spacing / 2 + let isRTL = UIView.userInterfaceLayoutDirection(for: semanticContentAttribute) == .rightToLeft + if isRTL { + imageEdgeInsets = UIEdgeInsets(top: 0, left: insetAmount, bottom: 0, right: -insetAmount) + titleEdgeInsets = UIEdgeInsets(top: 0, left: -insetAmount, bottom: 0, right: insetAmount) + contentEdgeInsets = UIEdgeInsets(top: 0, left: -insetAmount, bottom: 0, right: -insetAmount) + } else { + imageEdgeInsets = UIEdgeInsets(top: 0, left: -insetAmount, bottom: 0, right: insetAmount) + titleEdgeInsets = UIEdgeInsets(top: 0, left: insetAmount, bottom: 0, right: -insetAmount) + contentEdgeInsets = UIEdgeInsets(top: 0, left: insetAmount, bottom: 0, right: insetAmount) + } + } +} + extension NSData { func sha1() -> String { var digest = [UInt8](repeating: 0, count: Int(CC_SHA1_DIGEST_LENGTH)) diff --git a/deltachat-ios/View/ChatListEditingBar.swift b/deltachat-ios/View/ChatListEditingBar.swift index d7238d947..a20e1fc82 100644 --- a/deltachat-ios/View/ChatListEditingBar.swift +++ b/deltachat-ios/View/ChatListEditingBar.swift @@ -75,7 +75,7 @@ class ChatListEditingBar: UIView { if showImageAndText { button.setTitle(imageDescription, for: .normal) button.setTitleColor(tintColor, for: .normal) - button.imageEdgeInsets = UIEdgeInsets(top: 0, left: -10, bottom: 0, right: 0) + button.fixImageAndTitleSpacing() } } else { button.setTitle(imageDescription, for: .normal)