SwipeMenuViewController
SwipeMenuViewController copied to clipboard
Added support for multiple lines title text
Added support for multiple lines title text with swipe menu segment style so that we can overcome the issue of text truncation.
Support has been added in the below classes:
1. SwipeMenuView.swift at L38 to L41 Added new public parameter in a function i.e. public struct ItemView {....} After:
/// ItemView title number of lines . Defaults to `1`.
public var numberOfLines: Int = 1
2. TabView.swift at L218 to L224. Modified the existing function i.e. fileprivate func setupTabItemViews(dataSource: TabViewDataSource) {....} Before:
if let title = dataSource.tabView(self, titleForItemAt: index) {
tabItemView.titleLabel.text = title
tabItemView.titleLabel.font = options.itemView.font
tabItemView.textColor = options.itemView.textColor
tabItemView.selectedTextColor = options.itemView.selectedTextColor
}
After:
if let title = dataSource.tabView(self, titleForItemAt: index) {
let itemView = options.itemView
tabItemView.titleLabel.text = title
tabItemView.titleLabel.numberOfLines = itemView.numberOfLines // Change for multiple lines
tabItemView.titleLabel.font = itemView.font
tabItemView.textColor = itemView.textColor
tabItemView.selectedTextColor = itemView.selectedTextColor
}
Final Result:
Before Changes:
After Changes:
Regards.