i have two issues that are quite the same 1) I have a UIButton in a cell that calls a IBAction :
- (IBAction)deleteFriend:(id)sender
{
CGPoint buttonPosition = [sender convertPoint:CGPointZero toView:self->table];
NSIndexPath *indexPath = [self->table indexPathForRowAtPoint:buttonPosition];
if (indexPath != nil)
{
UITableViewCell *cell = [self->table cellForRowAtIndexPath:indexPath];
[UIView animateWithDuration:0.3 animations:^{
cell.alpha = 0;
} completion: ^(BOOL finished) {
cell.hidden = YES;
button.hidden = YES;
}];
}
So basically i would like a confirm alert before the IBAction, but here is the problem. I don't know how to pass the sender to the buttonIndex of the UIAlertView so it can make the job of this IBAction
2) Here in the code i tell the cell ( the cell in the IBAction ) to hide, but also the button that i defined in cellforRowatIndexPath :
button = [UIButton buttonWithType:UIButtonTypeCustom];
[button setBackgroundImage:buttonImage forState:UIControlStateNormal];
button.frame = CGRectMake(272.0f, 15.0f, 30.0f, 30.0f);
[cell button];
[button addTarget:self action:@selector(deleteFriend:)
forControlEvents:UIControlEventTouchUpInside];
but somehow it randomly hides other button in other cells. Why the heck doesn't it just hide in one cell ?
thanks in advance !