0

在我的应用程序中,我需要在实践中运行 2 个“Storyboard Follows”,当用户选择单元格时,它会根据布尔值推送到特定的视图控制器中。

Tableview 包含一个考试列表......我希望:

  当用户选择考试时 Not Completed 被推送到 ViewController 1 当用户选择考试时 Complete 被推送到 ViewController 2

直到现在我一直用

-(无效)prepareForSegue:(UIStoryboardSegue *)发件人如下:(id)发件人

但是当然,当我从单元连接两个跟随时,应用程序崩溃了

我向你展示了故事板中的代码 PS 我将单元连接到两个不同的视图控制器。如果这是错误的,你可以告诉我如何解决这个问题?感谢您所做的一切,如果问题不是真正的问题,我们很抱歉:)

我用 Parse.com

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
 {

 if ([[segue identifier]isEqualToString:@"DettaglioOggetto"])
 {
     NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow];
     PFObject *rowObject = [self.objects objectAtIndex:indexPath.row];
     if([[rowObject objectForKey:FF_ESAMI_STATUS] boolValue])
     {
         //DATO CONVALIDATO
         PFObject *object = [self.objects objectAtIndex:indexPath.row];
         FFDettagliEsami *FFDestinationDetails = [segue destinationViewController];
         FFDestinationDetails.FFObjectForDetails = object;

     } else if ([[segue identifier] isEqualToString:@"Dettaglio"]){

      //   NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow];
         PFObject *object = [self.objects objectAtIndex:indexPath.row];
         FFSchedaEsameConvalidato *FFDestinationDetails = [segue destinationViewController];
         FFDestinationDetails.FFObjectForDetails1 = object;

     }

 }  }
4

1 回答 1

0

已解决...我直接从包含 TableView 的 viewcontroller 连接,使用 CTRL + 拖动视图控制器目标,然后

- (Void) prepareForSegue: (UIStoryboardSegue *) sender follows: (id) sender
{

if ([[segue identifier] isEqualToString: @ "SegueDaConvalidare"]) {
NSIndexPath * indexPath = [self.tableView indexPathForSelectedRow];
PFObject * object = [self.objects objectAtIndex: indexPath.row];
FFDettagliEsami * = FFDestinationDetails [more destinationViewController];
FFDestinationDetails.FFObjectForDetails = object;}
    
if ([[segue identifier] isEqualToString: @ "SegueConvalidato"]) {
NSIndexPath * indexPath = [self.tableView indexPathForSelectedRow];
PFObject * object = [self.objects objectAtIndex: indexPath.row];
FFSchedaEsameConvalidato * = FFDestinationDetails [more destinationViewController];
FFDestinationDetails.FFObjectForDetails1 = object;}
}

然后我实现了方法 didSelectedRowAtIndexPath ,现在一切正常。

于 2013-10-11T00:08:01.813 回答