1, use Prepareforsegue:
-(void) Prepareforsegue: (Uistoryboardsegue *) Segue sender: (ID) sender{ * Detailcontroller =Segue.destinationviewcontroller; *bug = [self.bugs objectAtIndex:self.tableView.indexPathForSelectedRow.row]; = bug;}
2, use Prepareforsegue:
If you want to programmatically invoke a push segue, you give the Segue a "storyboard id" in Interface Builder and then yo U can:
[Self performseguewithidentifier:"pushtomyvc" sender:self];
3, without Prepareforsegue:
Alternatively, if you don ' t want to perform the segue, you can instantiate the destination view controller and then manual Ly push to that view controller. All your need to do are to make sure, the destination view controller have its own ' storyboard id ' in Interface Builder, Then you can:
Uiviewcontroller *controller = [Self.storyboard instantiateviewcontrollerwithidentifier:@ " Destinationcontroller"]; [Self.navigationcontroller Pushviewcontroller:controller Animated:yes];
pushViewControllerabove). If you really meant to "present a modal View controller" and then the second line is:
[Self Presentviewcontroller:controller animated:yes completion:nil];
prepareForSegue have prepareForSegue If you want to pass information to the destination view controller. Otherwise it is not needed.
prepareForSegueIs isn't applicable in that environment. If you were using NIB, it would is as follows:
Secondviewcontroller *controller = [[Secondviewcontroller alloc] Initwithnibname:@ " Secondviewcontroller"Bundle:nil" ; [Self.navigationcontroller Pushviewcontroller:controller Animated:yes];
Switching methods between iOS UI, using Prepareforsegue and not