diff --git a/Sources/SwipeMenuView.swift b/Sources/SwipeMenuView.swift index 275d2b6..c914f7c 100644 --- a/Sources/SwipeMenuView.swift +++ b/Sources/SwipeMenuView.swift @@ -19,8 +19,13 @@ public struct SwipeMenuViewOptions { public struct ItemView { /// ItemView width. Defaults to `100.0`. + /// needsAdjustItemViewWidth がfalseの際に適用される public var width: CGFloat = 100.0 + /// ItemViewminimum width. + /// needsAdjustItemViewWidth がtrueの際に設定した値以下のWidthにならないように調整する + public var minimumItemWidth: CGFloat = 0 + /// ItemView side padding. Defaults to `5.0`. public var padding: CGFloat = 5.0 diff --git a/Sources/TabView.swift b/Sources/TabView.swift index b67422f..906be46 100644 --- a/Sources/TabView.swift +++ b/Sources/TabView.swift @@ -235,7 +235,9 @@ open class TabView: UIScrollView { case .flexible: if options.needsAdjustItemViewWidth { var adjustCellSize = tabItemView.frame.size - adjustCellSize.width = tabItemView.titleLabel.sizeThatFits(containerView.frame.size).width + options.itemView.padding * 2 + let adjustWidth = tabItemView.titleLabel.sizeThatFits(containerView.frame.size).width + options.itemView.padding * 2 + let adjustCellSizeWidth = max(adjustWidth, options.itemView.minimumItemWidth) + adjustCellSize.width = adjustCellSizeWidth tabItemView.frame.size = adjustCellSize containerView.addArrangedSubview(tabItemView)