Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I was also having a problem figuring out how to do a page jump. and everything I was doing was dead ending on me, even all of the things suggested in chat. using your method I was able to see that a call though to the function had occurred and it had pulled the data from the modal view controller as well. but it gave me a null object error. when going to set the view. so I put in some more diagnostic messages to see what all was going on, as I had pretty much pieced together what is supposed to happen. all the data I was putting in was flowing through fine. the problem was the storyboard object was null for some reason and that caused it to fail in loading the items from the storyboard even though it knew which one to load, as far as it could tell there was nothing on the storyboard, so the modal view passed back an empty object. and then it crashed back in the main one. so this lead me to try to figure out why the storyboard object was null. how come it was dealloc'ed early? was my first question i thought I'd try to make a copy of it so that way we can use the copy from there on still no dice. then a thought hit me (thanks to god) in the top view controller we are using alloc and init that's how you create a new object. could it be that instead of creating a link back to the actual root controller that command created a 2nd root controller witch then created a 2nd modal controller biased off the same class template that the program has for those class types and was passing the function call on to that. if so that new root view controller wouldn't have the storyboard from the first one. nor would it have any ability to affect it as they are effectively separate objects. so going on that assumption i realized i as back to start again as I couldn't use your method. but then another god given flash of inspiration what if I sent in a pointer to the actual root view controller up the chain to the top view controller and used the pointer to to the call back? so I tried that and lo and behold finally I got it to work.</p> <p>so what I ended up doing was setting a new property in the top view controller .h of type id like this</p> <pre><code>@property (weak,nonatomic) id homebase; </code></pre> <p>then put this in to the top view controllers .m file</p> <pre><code>@synthesize homebase; </code></pre> <p>then back in the root view controller, I modified the <strong>viewdidload</strong> and the handler for the rotation observer to add in this line right after where it creates the <strong>DataViewController</strong> </p> <pre><code>startingViewController.homebase=self; </code></pre> <p>which sets the property I defined in the top view controller to the address of the actual root view controller. last thing I did was to modify the button click event</p> <pre><code>- (IBAction)pushedbutton:(UIButton *)sender { if (homebase==nil) { NSLog(@"no homebase"); return; } [homebase jumpto:1]; } </code></pre> <p>now I found if i use this on the first page (and set the value to a page other then 1) then it'll jump to that page. if I use this on any other page it will spit out "no homebse" unless I rotate the device then it'll work.</p> <p>I tried modifying <strong>didFinishAnimating</strong> to see if I could slap the reference in there after it finished loading as it's not needed until the button is clicked, which can't happen until after this function runs, but got no access to that property from there that I can see.</p> <p>and after some more work I found the last step here would be to modify the the <strong>viewControllerAtIndex</strong> to also take the pointer and store it, and set it on the DataView controller before handing it back to be put up. then when it's called with a null pointer it uses the one it had stored instead. that way on both types of calls it has the pointer to hand off and then everything works out. even if you flip the page and don't rotate it first now.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload