I want to pass PFObject from VC1 to VC2. I know thats easy if I pass PFObject from Tableview to VC. Anyway, I have A VC with Tableview with the segue to detailVC (1) with ImageView. This ImageView would be shown in detailiamgeviewcontroller after tap image.(2) And I want to send pfobject to this Controller. But have no idea how to. Any idea?

(1)

if ([segue.identifier isEqualToString:@"showDetaill"])
{    
        NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow];
        PFObject *object = [self.objects objectAtIndex:indexPath.row];
        DetailViewController2 *detailViewController = [segue destinationViewController];
        detailViewController.objecteditem = object;
}

(2)

- (void)viewDidLoad
{
    [super viewDidLoad];

    [self.imageviewsecond setImageWithURL:[NSURL URLWithString:[self.objecteditem objectForKey:@"VlajkaURL"]]
                      placeholderImage:[UIImage imageNamed:@"placeholder.png"]];


    UITapGestureRecognizer *singleTap =
    [[UITapGestureRecognizer alloc] initWithTarget:self
                                            action:@selector(handleSingleTap:)];
    singleTap.numberOfTapsRequired = 1;
    [imageviewsecond addGestureRecognizer:singleTap];

}
- (void)handleSingleTap:(UIGestureRecognizer *)sender
{
    [self performSegueWithIdentifier:@"sendi" sender:self];

    NSLog(@"image tapped!!!");

}
有帮助吗?

解决方案

Do the same as you are already doing. In view 1 you are sending the object to view 2 (DetailViewController2). In DetailViewController2, in the prepareForSegue method, you do the same:

if ([segue.identifier isEqualToString:@"sendi"])
{    
        DetailImageViewController *detailImageViewController = [segue destinationViewController];
        detailImageViewController.somePropertyName = self.objecteditem;
}
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top