ios - Receiver has no segue with identifier ... programmatically created segue -
programmatically created segue crashes app on performseguewithidentifier:, don't want use storyboard though.
- (void)viewdidload { [super viewdidload]; // additional setup after loading view. viewcontroller *viewcontroller = [[viewcontroller alloc] init]; self.segue = [[uistoryboardsegue alloc] initwithidentifier:@"showinfo" source:self destination:viewcontroller]; //change background color white self.view.backgroundcolor = [uicolor whitecolor]; //create table view uitableview *tableview = [[uitableview alloc] init]; //initialize data source , delegate self - methods going specified in script tableview.datasource = self; tableview.delegate = self; //register class tableview [tableview registerclass:[uitableviewcell class] forcellreuseidentifier:@"cell"]; //now assign table view our our viewcontroller's property self.view = tableview;}
segues can't created programmatically. apple's documentation says:
you not create segue objects directly. instead, storyboard runtime creates them when must perform segue between 2 view controllers.
the initwithidentifier:source:destination: method subclassing purposes.
that said, if you're not using storyboards don't need segues anyway. instantiate , present destination view controller when need to.
Comments
Post a Comment