Hi
I have a custom UITableViewCell and in there except from other elements i want to draw two buttons which once either pressed the one animates a transformation on the button and the other changes picture(actual actions dont matter that much).What happens is that except for the cell in which the button was pressed i see the effect in other cells too.
Also if i use an animation i see the transformed button drawn behind the normal one..one on top of the other
to be more precise heres a sample of my code:
Is this a completely the wrong way to go ?
I have a custom UITableViewCell and in there except from other elements i want to draw two buttons which once either pressed the one animates a transformation on the button and the other changes picture(actual actions dont matter that much).What happens is that except for the cell in which the button was pressed i see the effect in other cells too.
Also if i use an animation i see the transformed button drawn behind the normal one..one on top of the other
to be more precise heres a sample of my code:
Code:
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
AnswerView * cell = (AnswerView *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
UIButton * thumbsUp;
if(cell == nil)
{
cell = [[[AnswerView alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
button= [[[UIButton alloc] initWithFrame:CGRectMake(x, y, w,
h)]autorelease];
button.tag = 2;
[button addTarget:self action:@selector(clicked:) forControlEvents:UIControlEventTouchUpInside];
}
else
button = (UIButton *)[cell.contentView viewWithTag:2];
if(/* some logic involving indexPath.row */)
[button setFrame: ]
else
[button setFrame:
...
[cell.contentView addSubView:button];
return cell;
}
Is this a completely the wrong way to go ?