Load image on table view cell selected

375 views Asked by At

I have table view as popover on button click.I wanted that particular image to be loaded when user selects any particular table view cell.I have written code like this,but its not working.

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSString *selectedRow = [clientNameArrays objectAtIndex:indexPath.row];

    ClientDetailsView *obj = [[ClientDetailsView alloc]init];
    //obj.imageClientImage = clientImageArays;
    obj.clientImage.image = (UIImage*)clientImageArays;
}

How can I do this?

1

There are 1 answers

0
Kumar KL On

You are not at all presenting the ViewController : You are about to initialise the ViewController with Image but How the code came to know that, this should should need to be present :

Try Presenting Or Push Or POPOver OR UIView to present it. For Ex:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSString *selectedRow = [clientNameArrays objectAtIndex:indexPath.row];

    ClientDetailsView *obj = [[ClientDetailsView alloc]init];
    //obj.imageClientImage = clientImageArays;
    obj.clientImage.image = (UIImage*)clientImageArays;
     [self presentViewController:obj animated:YES completion:nil];
}