objective c - iPhone - difference between topViewController and other forms -
i on delegate of navigationcontrol based app.
when try access rootviewcontroller using
rootviewcontroller *rootviewcontroller = (rootviewcontroller *)[navigationcontroller topviewcontroller]; to run method, crashes, saying method "unknown" on rootviewcontroller.
when access rootviewcontroller using this
rootviewcontroller *rootviewcontroller = (rootviewcontroller *)[navigationcontroller.viewcontrollers objectatindex:0]; it works.
which object first line accessing?
thanks
topviewcontroller of navigation controller represents view controller @ top of stack. index 0 bottom. topviewcontroller object @ index 0 when 1 view controller on stack. if have more one, not same. guessing case it's crashing because topviewcontroller doesn't know how respond messages intended rootviewcontroller instance.
Comments
Post a Comment