Is there a way to set the UITableViewCell.image to display on the right hand side of the cell instead of the left? Or will I need to add a separate UIImageView on the right side of the cell layout?
A:
No you cannot. Add a new image.
You should look at the 3.0 SDK for this functionality too.
Roger Nolan
2009-04-23 06:01:39
+8
A:
No. But you can easily add an image view as the accessory view to a table cell for the same effect.
UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imagedNamed:@"foo.png"]];
cell.accessoryView = imageView;
[imageView release];
Squeegy
2009-04-23 17:12:27
Will changing the accessory view then overwrite the disclosure indicator?
Oliver GL
2009-04-23 21:20:04
Yeah, it would. If you want that then you have to manually add a UIImageView to your cell on creation. Or create a subclass for your special table cell that wraps that all up nicely for you.
Squeegy
2009-04-23 23:46:34
A:
This Soln is for adding different image in each cell....Just a Try
// Customize the appearance of table view cells. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
if(indexPath.row == 0)
{
cell.image = [UIImage imageNamed:@"image.png"];
}
else if (indexPath.row == 1)
{
cell.image = [UIImage imageNamed:@"image1.png"];
}