使用Parse.com的多个Segue Storyboard whit TableViewCell

时间:2013-10-10 20:43:12

标签: uitableview parse-platform uistoryboardsegue

在我的应用程序中,我需要在实践中运行2“Storyboard Follows”,当用户选择基于布尔值将单元格推入特定视图控制器时。

Tableview包含一份考试清单......我希望如此:

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

直到现在我总是使用

- (虚空)prepareForSegue :( UIStoryboardSegue *)发件人如下:(id)发件人

但当然我从单元格连接两个后续应用程序崩溃

我给你看了代码 附:在故事板中我将单元格连接到两个不同的viewcontroller ..如果这是错误的你可以告诉我如何解决这个问题? 谢谢你的一切,如果这个问题不是真的问题,我很抱歉:)

我用过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;

     }

 }  }

1 个答案:

答案 0 :(得分: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,现在一切正常。