objective c - iOS - Pass Data Multiple Times From Parent View Into Container View's View -
i have uipageviewcontroller
, , 1 of view controller
s has container view
parent view controller
passes data container can display dynamic data. have parent view passing data view within container view prepareforsegue
method:
//in storyboard-based application, want little preparation before navigation - (void)prepareforsegue:(uistoryboardsegue *)segue sender:(id)sender { nslog(@"called prepare segue"); if ([segue.identifier isequaltostring:@"viewembed"]) { //pass data } }
however, prepareforsegue
method called once (note nslog debugging statement), need pass different data child view every time uipageviewcontroller
swipes parent view. noticed viewdidload
method fires once in parent view because uipageviewcontroller
retains state of pages.
is there way re-instantiate (call viewdidload again) parent view every time swiped uipageviewcontroller
? i'm thinking make prepareforsegue
method fire more once, need do. or thinking wrong way , there more elegant solution?
any or advice appreciated. thanks.
the view did load called once segue since view loaded once. should manually by
- register delegate updades on
uipageviewcontroller
impelemt
- (void)pageviewcontroller:(uipageviewcontroller * nonnull)pageviewcontroller willtransitiontoviewcontrollers:(nsarray<uiviewcontroller *> * nonnull)pendingviewcontrollers
receive these updatescall method on child but not
viewdidload
,viewwillappear
orviewdidappear
since there code should not executed multiple times. should copy current viewdidload code child new method , call method parent when delegate method called
Comments
Post a Comment