2013-06-05 122 views
0

我有一个图片视图(点击我在其中获取弹出窗口)在表格视图中关联的单元格内。 日志元素树捕获静态文本'图片',但它不显示关联的图像视图。如何点击表格视图中的单元格中的图片视图

我流就像表 - >细胞(具有约4细胞,其是静态文本)

这些细胞依次附上与之文本框。 cell1-> textfields1 cell2-> textfields2 cell3-> textfields3 cell4->只有一张图片。

如何访问此图片?

var imageId = table[0].cells()[4]; 

    imageId.images(); 

不返回任何东西。

+0

我认为你必须要通过自定义单元格 –

+0

做到这一点我如何自定义单元格?并访问它? – Thejaswi

+0

@MH babu我不想让我的主人做任何代码更改..我只想直接访问图像视图。而无需将其更改为按钮。这可能吗? – Thejaswi

回答

0

我认为ü可以配置乌尔细胞是这样的:

(的UITableViewCell *)的tableView:(UITableView的*)的tableView的cellForRowAtIndexPath:(NSIndexPath *)indexPath { 静态的NSString * CellIdentifier = @ “小区”;

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 
if (cell == nil) { 
    cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]autorelease]; 

}

CGRect Frame4 = CGRectMake(10.0, 30.0, 50.0, 40.0); 
    UIButton *button = [UIButton buttonWithType:UIButtonTypeDetailDisclosure]; 
    button.frame = Frame4; 
    [button setTitle:@"Click" forState:UIControlStateNormal]; 
    button.backgroundColor = [UIColor grayColor]; 
    [button addTarget:self 
      action:@selector(buttonPressed:) forControlEvents:UIControlEventTouchUpInside]; 
    [cell.contentView addSubview:button]; 




return cell; 

}

然后添加按钮操作事件:

  • (IBAction为)buttonPressed:(的UIButton *)发件人{

    //在发件人你可以得到,但吨按下 //做点什么 }

请更换“UIButtonTypeDetailDisclosure”乌拉圭回合欲望图像按钮

相关问题