mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-20 01:08:15 +01:00
[escher] Add methods viewWillAppear/Disappear in view controller instead
of keeping track of dataHasChanged in the selectable table view Change-Id: Id2626f527f44714e29b9bd66e2c843193e1b57b5
This commit is contained in:
@@ -91,6 +91,10 @@ void StackViewController::push(ViewController * vc, KDColor textColor, KDColor b
|
||||
m_view.pushStack(vc->title(), textColor, backgroundColor, separatorColor);
|
||||
m_children[m_numberOfChildren++] = vc;
|
||||
setupActiveViewController();
|
||||
if (m_numberOfChildren > 1) {
|
||||
m_children[m_numberOfChildren-2]->viewWillDisappear();
|
||||
}
|
||||
vc->viewWillAppear();
|
||||
}
|
||||
|
||||
void StackViewController::pop() {
|
||||
@@ -100,6 +104,8 @@ void StackViewController::pop() {
|
||||
vc->setParentResponder(nullptr);
|
||||
m_numberOfChildren--;
|
||||
setupActiveViewController();
|
||||
vc->viewWillDisappear();
|
||||
m_children[m_numberOfChildren-1]->viewWillAppear();
|
||||
}
|
||||
|
||||
void StackViewController::setupActiveViewController() {
|
||||
@@ -129,3 +135,17 @@ bool StackViewController::handleEvent(Ion::Events::Event event) {
|
||||
View * StackViewController::view() {
|
||||
return &m_view;
|
||||
}
|
||||
|
||||
void StackViewController::viewWillAppear() {
|
||||
ViewController * vc = m_children[m_numberOfChildren-1];
|
||||
if (m_numberOfChildren > 0 && vc) {
|
||||
vc->viewWillAppear();
|
||||
}
|
||||
}
|
||||
|
||||
void StackViewController::viewWillDisappear() {
|
||||
ViewController * vc = m_children[m_numberOfChildren-1];
|
||||
if (m_numberOfChildren > 0 && vc) {
|
||||
vc->viewWillDisappear();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user