objective c - IOS Open New View controller Programatially -
i need open registration form on application programatically, view controller created on storyborad storybpard id viewcontrollerregister
, code have used open form
registrationformviewcontroller *registerview = [self.storyboard instantiateviewcontrollerwithidentifier:@"viewcontrollerregister"]; [self presentviewcontroller:registerview animated:no completion:nil];
but when run application, getting error like,
terminating app due uncaught exception 'nsinvalidargumentexception', reason: '* -[__nsarraym insertobject:atindex:]: object cannot nil' * first throw call stack:
1) make sure storyboardname "main" or different.
2) check have entered proper storyboard identifier.
and finally,
3) xcode can't able find storyboard self.storyboard
. try mention storyboard actual name like,
uistoryboard *storyboard = [uistoryboard storyboardwithname:@"main" bundle:[nsbundle mainbundle]]; registrationformviewcontroller *registrationformviewcontroller = [storyboard instantiateviewcontrollerwithidentifier:@"registrationformviewcontroller"]; [self presentviewcontroller:registrationformviewcontroller animated:yes completion:nil];
Comments
Post a Comment