0

enter image description here enter image description here

When I click on the button, the screen is not changed in which sidebar is embedded. I think it is a problem related to the class name given SWRevealView Controller to 2nd controller.

Can any one help me to sort out this problem? My code is:

- (IBAction)check:(id)sender {

    SWRevealViewController *vc= [self.storyboard instantiateViewControllerWithIdentifier:@"dash"];
    [self presentViewController:vc animated:YES completion:nil];

}
Nimit Parekh
  • 16,776
  • 8
  • 50
  • 72
Bansal
  • 67
  • 1
  • 1
  • 6
  • Do you check the identifier? Is vc is nil here? – Sofeda Aug 18 '16 at 10:09
  • yes it is not nil..when i click on login button then dasboard screen in which side bar is embeded with the help of SWRevealviewController is not open..the stimulator just open and close – Bansal Aug 18 '16 at 10:22
  • Do you have navigation controller here? – Sofeda Aug 18 '16 at 10:24
  • I given class name to dashboard screen is SWRevealviewcontroller and give identifier "dash" and use logic this: SWRevealViewController *vc= [self.storyboard instantiateViewControllerWithIdentifier:@"dash"]; [self presentViewController:vc animated:YES completion:nil]; – Bansal Aug 18 '16 at 10:24
  • can you show your storyboard scene – Anbu.Karthik Aug 18 '16 at 10:26
  • No my question from where you are tapping the button? Is that viewcontroller is under navigation controller? – Sofeda Aug 18 '16 at 10:26
  • where you want to open the side menu from login or somewhere else – Anbu.Karthik Aug 18 '16 at 10:27
  • no srry..i did not use navigation controller – Bansal Aug 18 '16 at 10:27
  • i am tapping the button from login screen.in login screen on login button is there when i press on that it does not move to dashboard screen in just only sidebar is embedded..but when side is not there it moved to dasboard screen – Bansal Aug 18 '16 at 10:30
  • And i given dashboard screen class name SWRevealViewController and after on login button action code is used. SWRevealViewController *vc= [self.storyboard instantiateViewControllerWithIdentifier:@"dash"]; [self presentViewController:vc animated:YES completion:nil]; – Bansal Aug 18 '16 at 10:33

1 Answers1

0

I tried sample one for your question.It shows the reveal view controller using button action.

First set the View Controller.Then set the Reveal View Controller.

 Utilities->Click Identity Inspector->Go to Identity(It is below to Custom Class)->Give 'dash' in Storyboard ID

First Screenshots show the ViewController and Reveal View Controller

enter image description here

Then I set 'dash' in storyboard id

enter image description here

Now in ViewController.m

- (IBAction)check:(id)sender
{
  SWRevealViewController *vc= [self.storyboard instantiateViewControllerWithIdentifier:@"dash"];
  [self presentViewController:vc animated:YES completion:nil];
}
user3182143
  • 9,459
  • 3
  • 32
  • 39