【问题标题】:Load image on table view cell selected在选定的表格视图单元格上加载图像
【发布时间】:2013-12-04 16:12:57
【问题描述】:

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

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

我该怎么做?

【问题讨论】:

  • 您在哪里展示 ClientDetailsView
  • 请详细说明ClientDetailsViewclientImageArays是什么?
  • ClientDetailsView 是上面的视图控制器,有 UIImageView 和 clientimagearray 是有图像的数组。

标签: ios objective-c uitableview uiimageview uipopover


【解决方案1】:

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

尝试Presenting Or Push Or POPOver OR UIView 来展示它。例如:

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

【讨论】:

    猜你喜欢
    • 2019-03-11
    • 1970-01-01
    • 1970-01-01
    • 2018-07-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多