diff --git a/Nextcloud.xcodeproj/project.pbxproj b/Nextcloud.xcodeproj/project.pbxproj index 52e8502a2f..5302517d6b 100644 --- a/Nextcloud.xcodeproj/project.pbxproj +++ b/Nextcloud.xcodeproj/project.pbxproj @@ -6246,7 +6246,7 @@ CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 3; + CURRENT_PROJECT_VERSION = 0; DEAD_CODE_STRIPPING = YES; DEBUG_INFORMATION_FORMAT = dwarf; DEVELOPMENT_TEAM = NKUJUXUJ3B; @@ -6273,7 +6273,7 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - MARKETING_VERSION = 33.1.2; + MARKETING_VERSION = 33.1.3; ONLY_ACTIVE_ARCH = YES; OTHER_CFLAGS = "-v"; OTHER_LDFLAGS = ""; @@ -6314,7 +6314,7 @@ CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 3; + CURRENT_PROJECT_VERSION = 0; DEAD_CODE_STRIPPING = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEVELOPMENT_TEAM = NKUJUXUJ3B; @@ -6339,7 +6339,7 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - MARKETING_VERSION = 33.1.2; + MARKETING_VERSION = 33.1.3; ONLY_ACTIVE_ARCH = YES; OTHER_CFLAGS = "-v"; OTHER_LDFLAGS = ""; diff --git a/iOSClient/Viewer/NCViewerMedia/Views/NCMediaViewerFloatingTitleView.swift b/iOSClient/Viewer/NCViewerMedia/Views/NCMediaViewerFloatingTitleView.swift index 6cba29d834..e68d5f3660 100644 --- a/iOSClient/Viewer/NCViewerMedia/Views/NCMediaViewerFloatingTitleView.swift +++ b/iOSClient/Viewer/NCViewerMedia/Views/NCMediaViewerFloatingTitleView.swift @@ -9,6 +9,7 @@ final class NCMediaViewerFloatingTitleView: UIView { private var navigationBarConstraints: [NSLayoutConstraint] = [] private var centerXConstraint: NSLayoutConstraint? private var heightConstraint: NSLayoutConstraint? + private var lastLayoutWidth: CGFloat = 0 private let titleButton: UIButton = { let button: UIButton @@ -54,12 +55,25 @@ final class NCMediaViewerFloatingTitleView: UIView { override func layoutSubviews() { super.layoutSubviews() + guard bounds.width != lastLayoutWidth else { + return + } + + lastLayoutWidth = bounds.width + + let leadingInset = titleButton.configuration?.contentInsets.leading ?? 0 + let trailingInset = titleButton.configuration?.contentInsets.trailing ?? 0 + + titleButton.titleLabel?.preferredMaxLayoutWidth = max(0, bounds.width - leadingInset - trailingInset) + titleButton.titleLabel?.numberOfLines = 1 + titleButton.titleLabel?.lineBreakMode = .byTruncatingMiddle + var configuration = titleButton.configuration configuration?.titleAlignment = .center configuration?.titleLineBreakMode = .byTruncatingMiddle - titleButton.configuration = configuration - titleButton.titleLabel?.numberOfLines = 1 + + titleButton.invalidateIntrinsicContentSize() } func attach(to navigationBar: UINavigationBar, widthMultiplier: CGFloat = 0.36, verticalOffset: CGFloat = 0) { @@ -80,7 +94,7 @@ final class NCMediaViewerFloatingTitleView: UIView { topConstraint, heightConstraint, widthAnchor.constraint( - lessThanOrEqualTo: navigationBar.widthAnchor, + equalTo: navigationBar.widthAnchor, multiplier: widthMultiplier ) ] @@ -91,6 +105,7 @@ final class NCMediaViewerFloatingTitleView: UIView { navigationBar.bringSubviewToFront(self) updateNavigationItemHeight() updateHorizontalAlignment() + setNeedsLayout() } func updateHorizontalAlignment() { @@ -146,6 +161,9 @@ final class NCMediaViewerFloatingTitleView: UIView { } titleButton.configuration = configuration + lastLayoutWidth = 0 + setNeedsLayout() + isHidden = primaryText?.isEmpty ?? true accessibilityLabel = [