2013-02-09 63 views
-1

我正在使用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

回答

0

格式化你的代碼很清楚,你是從陣列的每兩個圖像視圖分配相同的圖像後。您將需要一個具有雙倍數量成員的imageViewArray。

此外,您不應該檢查您的圖像數組的數量,而是檢查索引路徑的row

+0

感謝您的回覆 – SampathKumar 2013-02-09 11:03:11