Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

queryModelChange #10

Closed
xinglie opened this issue Oct 2, 2012 · 1 comment
Closed

queryModelChange #10

xinglie opened this issue Oct 2, 2012 · 1 comment

Comments

@xinglie
Copy link
Collaborator

xinglie commented Oct 2, 2012

关于queryModelChange

  1. 当hash改变时,只需要告诉根view,再由根view向子view一层层的传递消息下去
  2. 当某个view中queryModelChange return false后,则中断消息的传递

目前所遇到的问题

假设如下的界面

┏━━━━━━━━━━━━━━━┓
┃      H        ┃
┃               ┃
┣━━━┳━━━━━━━━━━━┫
┃   ┃           ┃
┃   ┃  M┏━━━━━┓ ┃
┃ S ┃   ┃     ┃ ┃
┃   ┃   ┃  Z  ┃ ┃
┃   ┃   ┃     ┃ ┃
┃   ┃   ┗━━━━━┛ ┃
┗━━━┻━━━━━━━━━━━┛

  1. 我们有一个布局layout L
  2. 我们有H S M Z四个view,其中Z套在M中
  3. 当hash有改变时,告知L,L来决定是否向H S M发送hash改变的消息
  4. 有时候我们不需要告知子view,所以我们会通过return false中断消息传递
  5. 考虑hash改变时,L不需要告诉M H hash有变化,而S需要知道hash有变化,此时如果return false则S无法收到消息,而return true则又违背了M H不需要知道hash有变化的要求

根据遇到的这个问题,考虑return true或false外,提供一个return Array的功能,当返回值是数组是,我们只通知数组包含的view,这样或许能够解决掉这个通知的问题

@xinglie
Copy link
Collaborator Author

xinglie commented Jul 30, 2013

通过e.toChildren解决该问题,另外老版本中是采用return Array的方式来解决上述问题

@xinglie xinglie closed this as completed Jul 30, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant