Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Refactor PaperFoldMenuController to be more IB friendly. #3

Merged
merged 2 commits into from Nov 17, 2012

Conversation

Projects
None yet
2 participants
Contributor

lxcid commented Nov 16, 2012

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 added some commits Nov 16, 2012

@lxcid lxcid Child view controllers should be instance of `DemoRootViewController`…
… instead of `DemoMenuController`.

Although the previous version work, I believe this is the more appropriate intention.
d3d681d
@lxcid lxcid 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>
651163d
Contributor

lxcid commented Nov 16, 2012

d3d681d attempts to fix issue #2.

@honcheng honcheng added a commit that referenced this pull request Nov 17, 2012

@honcheng honcheng Merge pull request #3 from lxcid/master
Refactor PaperFoldMenuController to be more IB friendly.
efa0173

@honcheng honcheng merged commit efa0173 into honcheng:master Nov 17, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment