iPad中的UITableView问题?

问题描述:

我正在使用iPad应用程序。我正在使用UITableView来创建表格并在每个单元格中插入2 UIImageView。我试图在UIImageView s中设置图像,但是索引路径值从0,1,2,3,4等开始...iPad中的UITableView问题?

每个UIImageView在第一个单元格中具有相同的图像。如何解决这个问题?

enter image description here

例子:

- (void)viewDidLoad 
{ 
    [super viewDidLoad]; 

    // ImageArray have 5images; 
} 

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 
{ 


    return [ImageArray count]; 
} 

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    static NSString *CellIdentifier = @"Cell"; 
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 

    imgView1.image = [imageArray objectAtIndex:indexPath.row]; 
    imgView2.image = [imageArray objectAtIndex:indexPath.row]; 
} 
+0

你在哪里设置UIImageView,我的意思是它设置为cell.contentView? – iPatel 2013-02-09 10:50:29

+0

格式化你的问题 – 2013-02-09 10:50:38

+0

和wt你想显示在输出? – iPatel 2013-02-09 10:50:53

格式化你的代码很清楚,你是从阵列的每两个图像视图分配相同的图像后。您将需要一个具有双倍数量成员的imageViewArray。

此外,您不应该检查您的图像数组的数量,而是检查索引路径的row

+0

感谢您的回复 – SampathKumar 2013-02-09 11:03:11