How to change image when clicked on tableview cell iphone?

That is because the image is now removed when the cell is deselected (ie. When a new cell is selected).

That is because the image is now removed when the cell is deselected (ie. When a new cell is selected). Add a tableView reloadData as the first line in that method.

I did something similar, but not with images but buttons. If a cell wasn't selected yet and gets tabbed, the size is changed and a certain and individual number of buttons is added. If another cell was selected, this one gets closed.

Code from form the UITableViewController interface: int openedCellIndex;// article = self. FetchedResultsController objectAtIndexPath:indexPath; cell.textLabel. Text = article.Name; if ( self.

CellBackgroundColor ) cell. BackgroundColor = self. CellBackgroundColor; return cell; } else { //get article id article = self.

FetchedResultsController objectAtIndexPath:indexPath; //number of buttons int buttons = article. Specification count; int height = 50 * ceil(buttons / 2) + 50; //construct special cell UITableViewCell *cell = TRTableViewCell alloc initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"CellBig" autorelease; cell. Frame = CGRectMake (0,0, 320, 150); cell.textLabel.

Text = @""; //add label UILabel *label = UILabel alloc initWithFrame:CGRectMake(20, 10, 280, 30); label. Font = UIFont boldSystemFontOfSize:17; label. Text = article.

Name; label. BackgroundColor = UIColor clearColor; cell addSubview:label; label release; if ( buttonMapper == nil ) self. ButtonMapper = NSMutableDictionary dictionaryWithCapacity:10; //NSLog (@" bla: %@", article.

IsFreePrice); //see if we have a free prized article //create the buttons NSEnumerator *enumerator = article. Specification objectEnumerator; id spec; int count = 0; NSArray *specs = self sortedArticleSpecifications:article; for ( spec in specs ) { //see which row and col the button is in int row = floor ( count / 2 ); int col = count % 2; //define button position int left = 20 + col * 145; int top = 45 + row * 50; //create button UIButton *button = UIButton buttonWithType:UIButtonTypeRoundedRect; button. Frame = CGRectMake(left, top, 135, 40); cell addSubview:button; button setTitleColor:UIColor blackColor forState:0; button addTarget:self action:@selector(buttonTapped:) forControlEvents:UIControlEventTouchUpInside; //remember which article the button is attached to buttonCounter++; button.

Tag = buttonCounter; buttonMapper setValue:spec forKey:NSString stringWithFormat:@"bla%d",buttonCounter; count++; } if ( self. CellBackgroundColor ) cell. BackgroundColor = self.

CellBackgroundColor; return cell; } } - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { if ( openedCellIndex == indexPath. Row ) { id article = self. FetchedResultsController objectAtIndexPath:indexPath; int count = article.

Specification count; int height = 50 * ceil(count / 2. ) + 50; return height; } return 50; } - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { tableView deselectRowAtIndexPath:indexPath animated:YES; self openRow:indexPath. Row; self.

SearchBar resignFirstResponder; } - (void) openRow:(int) index { if ( index == openedCellIndex ) return; int oldIndex = openedCellIndex; openedCellIndex = index; NSUInteger indexArr = {0, oldIndex}; NSIndexPath *oldPath = NSIndexPath indexPathWithIndexes:indexArr length:2; NSUInteger indexArr2 = {0, openedCellIndex}; NSIndexPath *newPath = NSIndexPath indexPathWithIndexes:indexArr2 length:2; //update view (UITableView *)self. View beginUpdates; if ( oldIndex >= 0 ) (UITableView *)self. View reloadRowsAtIndexPaths:NSArray arrayWithObject:oldPath withRowAnimation:UITableViewRowAnimationFade; if (openedCellIndex >=0 ) (UITableView *)self.

View reloadRowsAtIndexPaths:NSArray arrayWithObject:newPath withRowAnimation:UITableViewRowAnimationFade; (UITableView *)self. View endUpdates; }.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions