0
我正在嘗試使應用程序顯示一個RSS源,並將文本和圖像放入表格中,但我真的非常困惑!IPhone-Rss示例代碼,修改爲顯示圖像... PLease help!
我找到了一個真正的好[示例代碼項目] [1],我真的可以recommend--但即時struggeling得到它在tablecells顯示圖像,而不是純文本
的我將與reeeeally快樂任何幫助!
感謝
我正在嘗試使應用程序顯示一個RSS源,並將文本和圖像放入表格中,但我真的非常困惑!IPhone-Rss示例代碼,修改爲顯示圖像... PLease help!
我找到了一個真正的好[示例代碼項目] [1],我真的可以recommend--但即時struggeling得到它在tablecells顯示圖像,而不是純文本
的我將與reeeeally快樂任何幫助!
感謝
添加UIImageView到您的表格的單元格,並設置它的image
屬性爲您的圖像。 你會想這樣做,在你cellForRowAtIndexPath:方法:
-(UITableViewCell *)tableView:(UITableView *) tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *MyIdentifer = @「MyIdentifier」;
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:MyIdentifier];
if(cell == nil) {
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero
reuseIdentifier:MyIdentifier] autorelease];
UIImageView *imgView = [[UIImageView alloc] initWithFrame: CGRectMake(3,3,75,75)];
imgView.tag = 7;
}
[cell setText: (NSString*)[yourTextArray objectAtIndex: indexPath.row];
UIImageView *theImgView = (UIImageView*)[cell viewWithTag: 7];
theImgView.image = (UIImage*)[yourImageArray objectAtIndex: indexPath.row]
return cell;
}
退房this article一個異步方法。