objective c - Passing NSIndexPath to New View? -
i having real troubles passing nsindexpath new view. how app works:
i have uibarbuttonitem in nab br, tap , popover view, shows bunch of stuff. need nsindexpath main view, popover view.
i have property nsindexpath in popover view class , popover transition connected in storyboard.
then have code pass index path across views:
-(void)prepareforsegue:(uistoryboardsegue *)segue sender:(id)sender { if ([segue.identifier isequaltostring:@"statspopover"]) { statsviewcontroller *statsvc = [segue destinationviewcontroller]; statsvc.selectedindex = stageselectiontable.indexpathforselectedrow; } }
however, while gets called, index path isn't sent between views. index path on popover default, 0,0 row , section.
hope can help, thanks.
you know debugging/logging method running, if
statement triggered, , stageselectiontable.indexpathforselectedrow
has value expect.
doing kind of diagnosis puts on right path solving issue. keep @ -- if test other things nslog
or debugger should able find problem.
do know
statsvc
non-nil
? if it'snil
, message setselectedindex
nothing.is
statsvc
class expect? if, say, (table?) view in popover embedded in navigation controller,segue.destinationviewcontroller
point nav controller, , you'll need child view controllers array find 1 you're looking for.is whatever accessor method
statsviewcontroller
class usingselectedindex
property working right? (this shouldn't problem if it's synthesized accessor strong/retain property.)in
statsviewcontroller
class, trying workselectedindex
before gets set? setting property inprepareforsegue:sender:
, using inviewdidload
should work fine, using inawakefromnib
might not, , using ininit...
method won't.
Comments
Post a Comment