honcheng / PaperFoldMenuController

A navigation menu on the left of the screen using on PaperFold
Other
436 stars 90 forks source link

Refactor PaperFoldMenuController to be more IB friendly. #3

Closed lxcid closed 11 years ago

lxcid commented 12 years ago

The summary of these changes are as follows:

  1. Use weak semantics for subviews. (Inline with generated IB subviews properties semantics)
  2. Defers setting up of subviews to viewDidLoad. (This helps in making it more IB friendly as IB won't be able to call initWithMenuWidth:numberOfFolds:, but if we exposes their properties, we can use user defined runtime attributes to set these value in IB)
  3. Introduces NSNotFound for selectedIndex. (When no view controller is selected, we describe this state as NSNotFound)
  4. Rewrote selectIndex and selectedViewController, making them observable by KVO. (Try to maintains only selectedIndex and make selectedViewController derives it value from selectedIndex)
  5. Updates DemoMenuController. (Same as 2, defer setting up of subviews in viewDidLoad. We actually have to manually invoke reloadMenu)

Cheers!

Signed-off-by: Stan Chang Khin Boon khinboon@gmail.com

lxcid commented 12 years ago

d3d681d attempts to fix issue #2.