Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to pop a viewController and then Push a viewController through delegation
    primarykey
    data
    text
    <p>I have a UITableViewController that when a cell is pressed, I want the controller to pop itself, and then have the controller it pop's to, push another view controller onto the stack.</p> <p>I am invoking this method because the popped-to viewController is the delegate of the tableViewController</p> <p>I am currently invoking this method with a delay on it, because otherwise, everything gets screwed up waiting for the animation to end. Doing it this way seems a bit hacky and seems to me like it would fail if someone's device didn't pop the view in the allotted wait time I have given it.</p> <p>Here is some of the code:</p> <pre><code>//**** code in my tableViewController ***// [self.navigationController popViewControllerAnimated:YES]; [self.delegate cellPressedInTableViewControllerWithCalculationsModel:(id)anArgmentMyDelegateMethodTakes]; // **** Code in the viewController being popped to ****// //CalculationsViewController is a subclass of UIViewController CalculationsViewController *calcViewController = [[CalculationsViewController alloc] init]; //some customization code would go her [self.navigationController performSelector:@selector(pushViewController:animated:) withObject:calcViewController afterDelay:0.75]; //this seems like the arbitrary part, the 0.75 second delay. [calcViewController release]; </code></pre> <p>There seems like there should be a better way to pop/push through delegation that will execute after the animation finishes. The wait time seems to me like it could cause unexpected problems.</p> <p>I have also tried using:</p> <pre><code> performSelectorOnMainThread:withObject:waitUntilDone </code></pre> <p>But the code just executes immediately and the view hierarchy screwed up.</p> <p>I have also looked at this question: <a href="https://stackoverflow.com/questions/6945634/how-to-push-or-pop-viewcontroller-through-delegation">Delegation question</a> and it has gotten me this far, but I am curious to see if there is a better way to perform such a task, Thanks. </p> <p>edit: I have also tried wrapping the method in an instance of NSInvocation, and I couldn't get it to coordinate the method call until after the animation finished without arbitrarily setting the delay</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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