kitasuke / PagingMenuController

Paging view controller with customizable menu in Swift
MIT License
2.5k stars 449 forks source link

Change menu background color on-the-fly #289

Open Sorix opened 7 years ago

Sorix commented 7 years ago

Changing PagingMenuController's option

Call setup method with new options again. It creates a new paging menu controller. Do not forget to cleanup properties in child view controller.

How can I change some properties of menu (for example background color of items / bar) on the fly? If I call .setup() method again with parameters -- than all my subviews are reloaded with flickr animation, it's not a good option.

Also if user have entering something inside subview -- all data is lost, because it's reloaded.

I've read that you had method .rebuild() but it was deprecated. Have framework any other methods to access PagingMenuController's options with ability to change it without view reloading?

Especially I need item's background color (not only current item).

flohei commented 7 years ago

+1, I'm currently looking for the same option.

markoengelman commented 7 years ago

+1 I am also looking for same option.

TheCodeTalker commented 7 years ago

you guys find any good option for this i facing same problem ?? let me know help needed @kitasuke

thanks chitaranjan

mapplics commented 7 years ago

anyone found a solution?

TheCodeTalker commented 7 years ago

i debugged it i found there is no method like to change to setup new color like this . i imp my own.. i found one solution i force full update the menuview like this self.pagingMenuController?.menuView.backgroundColor = UIColor.red For menu bar
self.pagingMenuController?.menuView.updateUnderLine(flagForUnderLine: scrollRGB(percent: Double((1 - ratio))))

i wrote a method inside MenuView.swift for changing color.

func updateUnderLine( flagForUnderLine: UIColor){ underlineView.backgroundColor = flagForUnderLine
}

my sol'n is working for me