6.2.2 Locate the target function from the UI function
Successfully getting the UI function is a perfect beginning. UI functions have close ties with
UI, namely, if we call [ComposeButtonItem _sendAction:withEvent:] to compose an email, or
call [PhoneSettingsController tableView:cellForRowAtIndexPath:] to get my number, a lot of
correlated events will happen on UI, such as the view will be refreshed, the layout will be
updated, etc. It is over reacting. In most cases, we just want to stay low and perform the
functions without interrupting the UI. So what should we do when facing this kind of challenge?
As developers, I assume you have the most basic programmatic knowledge: the lowest level
functions are written directly in assembly, which are far from us for now; the remaining
functions are all nested called. Since UI functions are rather high level functions, they certainly
nested call our target functions, which can be shown as the following pseudo code:
drink GetRegular(water arg)
{
Functions();
return MakeRegular(arg);
}
drink GetDiet(void)
{
Functions();
return MakeDiet();
}
drink GetZero(void)
{
Functions();
return MakeZero();
}
drink GetCoke(sugar arg1, water arg2, color arg3)
{
if (arg1 > 0 && arg1 < 3) return GetDiet();
else if (arg1 == 0) return GetZero();
return GetRegular(arg2);
}
drink Get7Up(void)
{
Functions();
return Make7Up();
}
drink GetMirinda(void)
{
Functions();
return MakeMirinda();
}
drink GetPepsi(sugar arg1, water arg2, color arg3)