在所选的表视图单元格上加载图像

时间:2013-12-04 08:03:30

标签: ios objective-c uitableview uiimageview uipopover

我在按钮点击时将表视图设置为popover。我希望在用户选择任何特定的表视图单元时加载该特定图像。我编写了这样的代码,但它不起作用。

- (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;
}

我该怎么做?

1 个答案:

答案 0 :(得分:0)

你根本不是presenting the ViewController:你即将initialise the ViewController with Image但是代码如何知道,这应该是应该存在的:

尝试Presenting Or Push Or POPOver OR UIView来展示它。对于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];
}