Hi all,
I am beginner with Xcode and all the programming in Objective-C.
So, here is my problem:
I would like to insert an image in a cell of a UITableView instance. My application looks like that for now :
The image you can see has been implemented thanks to an UIImageView instance but it is static and what I want is that it moves when scrolling.
The code section where I want to insert an image is the following (in Bold):
Code:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell* cell = [tableView dequeueReusableCellWithIdentifier:@"TestCell"];
if (cell == nil) {
CGRect rect;
rect = CGRectMake(0.0, 0.0, 320.0, 80.0);
cell = [[[UITableViewCell alloc] initWithFrame:rect reuseIdentifier:@"TestCell"] autorelease];
}
/* DESCRIPTION */
/* Below, you have two switch levels. The first one deals with the section number and
the second with the row number. */
{
switch (indexPath.section)
{
/* SECTION 0 */
case 0:
switch(indexPath.row)
{
case 0:
//image =
break;
case 1:
cell.text = [NSString stringWithFormat:@"Tomb Raider - Underworld", indexPath.section, indexPath.row];
return cell;
break;
default:
cell.text = [NSString stringWithFormat:@"Empty cell", indexPath.section, indexPath.row];
return cell;
break;
}
...
default:
cell.text = [NSString stringWithFormat:@"Section %d", indexPath.section, indexPath.row];
return cell;
break;
}
}
}
I hope it is enough clear and that it is possible.
Thanks.
