0

i created custom button using objective-c.when i click this button, next view will have to push.To do this i have written code as shown in below:

-(void)click1:(UIButton *)sender{
NSString * storyboardName = @"mystoryboard";
UIStoryboard* storyboard = [UIStoryboard storyboardWithName:storyboardName  bundle:nil];
secondViewController *add = [[secondViewController alloc]  initWithNibName:@"secondView" bundle:nil];
add =[storyboard instantiateViewControllerWithIdentifier:@"newseg1"];
[self presentViewController:add animated:YES completion:nil];

I got error like this:"could not find storyboardName in NSBundle...".i don't know what i have to put in storyboardName.can anyone explain it?

Madhu M
  • 41
  • 1
  • 6
  • If your method is in a `UIViewController` and the target view controller is in the same storyboard, you can use `[self storyboard]` to get the current storyboard rather than using `[UIStoryboard storyboardWithName...]`. – ttarik Oct 24 '14 at 05:28
  • try this http://stackoverflow.com/questions/23102978/swrevealviewcontroller-without-using-navigationcontroller/23105142#23105142 – Anbu.Karthik Oct 24 '14 at 05:32

1 Answers1

0

Your storyboardName should be storyBoard file name in your project.It is case sensitive.If in project explorer you are seeing Main.storyboard just pass Main without storyboard

NSString * storyboardName = @"Main";
codester
  • 36,891
  • 10
  • 74
  • 72
  • thanks.i created a secondViewcontroller in storyboard and created push with identifier as newseg1.but the error show as:"Receiver () has no segue with identifier 'newseg1''" will u pls help me? – Madhu M Oct 24 '14 at 05:43