0

I am new to ios.I am debugging a code and i have gone through the following lines i dont understand the functionality.Let me know if any one understands.

- (void)prepareForSegue: (UIStoryboardSegue *) segue sender: (id) sender{

   if ( [segue isKindOfClass: [SWRevealViewControllerSegue class]] ) {

        SWRevealViewControllerSegue *swSegue = (SWRevealViewControllerSegue*) segue;
      __typeof(self) __weak weakSelf = self;

      swSegue.performBlock = ^(SWRevealViewControllerSegue* rvc_segue, UIViewController* svc, UIViewController* dvc){

            UINavigationController* navController = (UINavigationController*) weakSelf.revealViewController.frontViewController;
            [navController setViewControllers: @[dvc] animated: NO ];
            [weakSelf.revealViewController setFrontViewPosition: FrontViewPositionLeft animated: YES];

      };

    }

}
Anoop Vaidya
  • 46,283
  • 15
  • 111
  • 140
  • __typeof(self) __weak weakSelf = self; it get a weak reference for your controller, to avoid retain cycle. – Pawan Rai May 09 '14 at 06:38

1 Answers1

4

You can push to new viewcontroller with "prepareForSegue" method

But in this code, Custom segue will be performed in place of native animation during the Push of Destination viewcontroller

SWRevealViewControllerSegue is the class for the custom segue, You can see the push animation code there.

Amit Bhavsar
  • 1,273
  • 12
  • 23