objective c - Changing View Controllers - SIGABRT -
i trying move 1 view controller when button pressed, giving me "sigabrt" error.
this code:
-(ibaction)buttonpressed:(id)sender{ statsviewcontroller *mystats = [self.storyboard instantiateviewcontrollerwithidentifier:@"statsviewcontroller"]; [self presentviewcontroller:mystats animated:yes completion:nil]; } the reason doing way because need pass data forward 1 view controller next.
i checked storyboard there no connections between 2 view controllers (just above code).
however, when remove above code , connect 2 view controller using "control drag" method on storyboard, works. no error..
make sure storyboard instance not nil , and storyboard id set properly
-(ibaction)buttonpressed:(id)sender{ uistoryboard *storyboard = [uistoryboard storyboardwithname:@"mainstoryboard" bundle: nil]; statsviewcontroller *lvc = [storyboard instantiateviewcontrollerwithidentifier:@"statsviewcontroller"]; [self.navigationcontroller pushviewcontroller:lvc animated:yes]; }
Comments
Post a Comment