2012-10-09 47 views
-2

直到2天我試圖從一個plist文件中加載一些圖像到我的表格視圖行中。我在創建NSMutableArray的時候,在返回之前將這行 cell.imageView.image = [UIImage imageNamed:[images objectAtIndex:row]];添加到了「cellForRowAtIndexPath」方法中,xcode給了我這個錯誤: 使用未聲明的標識符'cell'和不兼容的整數轉換指針向NSUInteger類型的參數發送double。TableView的ImageView

什麼問題?

+2

一小段代碼可能會有幫助 – iSofTom

+0

試試這個NSString * CellIdentifier = [NSString stringWithFormat:@「%i」,indexPath.row]; UITableViewCell * cell =(UITableViewCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier]; –

+0

@Venkat Manohar我試過你的代碼機器人沒有圖像。 –

回答

0

添加這些,

static NSString *CellIdentifier [email protected]"Cell"; 

    UITableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 
+0

我需要將此行添加到cellForRowtIndexPath嗎?它不適用於這條線 –

0

關於第二部分,其中「不相容指針整數轉換髮送給雙類型的參數NSUInteger」。檢查數據類型row。如果不是NSUInteger,則不能使用[images objectAtIndex:row]。試試[images objectAtIndex:indexPath.row]而不是那個。關於第一個問題,我同意上面的評論cell未被聲明和初始化。您需要聲明它並分配內存。

相關問題