PageMenu / PageMenu

A paging menu controller built from other view controllers placed inside a scroll view (like Spotify, Windows Phone, Instagram)
BSD 3-Clause "New" or "Revised" License
5.27k stars 900 forks source link

Dynamic menu title width #487

Open PrakashMaharjan opened 5 years ago

PrakashMaharjan commented 5 years ago

Hi,

How to set dynamic title for menu based on the text? Currently I am using menuItemWidth Property value hardcoded as parameter. But for some text length short and for some text length long, it is not working properly.

let parameters: [CAPSPageMenuOption] = [ .menuItemSeparatorWidth(4.3), .useMenuLikeSegmentedControl(false), .menuItemSeparatorPercentageHeight(0.1), .menuHeight(44.0), .menuItemWidth(100.0), .scrollMenuBackgroundColor(.blue), .unselectedMenuItemLabelColor(.white), /.viewBackgroundColor(.blue) ]

How to set the menu item width based on width of the view title text?

Any suggestion would be appreciated.

Thank you

PrakashMaharjan commented 5 years ago

fixed out by adding

.menuItemWidthBasedOnTitleTextWidth(true) in parameters.

YeKoKoHtetMMDS commented 4 years ago

How to set Dynamic menu title two lines?