It looks like you're new here. If you want to get involved, click one of these buttons!
- (void)editItems:(UIButton *)button {
if (!isEditing) {
NSLog(@\"Editing...\");
isEditing = YES;
[UIView beginAnimations:@\"editButtonFlipContext\" context:nil];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:cell.checkmarkImage cache:YES];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationDuration:0.3];
cell.checkmarkImage.image = [UIImage imageNamed:@\"data_cell_delete_button.png\"];
[UIView commitAnimations];
[cell.checkmarkButton addTarget:self action:@selector(deleteCell:event:) forControlEvents:UIControlEventTouchUpInside];
} else {
NSLog(@\"Done Editing.\");
isEditing = NO;
[NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(deleteCell:event:) object:nil];
[UIView beginAnimations:@\"editButtonFlipContext\" context:nil];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:cell.checkmarkImage cache:YES];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationDuration:0.3];
cell.checkmarkImage.image = [UIImage imageNamed:@\"data_cell_detail_button.png\"];
[UIView commitAnimations];
}
}- (void)deleteCell:(id)sender event:(id)event {
NSSet *touches = [event allTouches];
UITouch *touch = [touches anyObject];
CGPoint currentTouchPosition = [touch locationInView:self.tableView];
NSIndexPath *indexPath = [self.tableView indexPathForRowAtPoint: currentTouchPosition];
if (indexPath != nil)
{
NSManagedObjectContext *context = [self.fetchedResultsController managedObjectContext];
[context deleteObject:[self.fetchedResultsController objectAtIndexPath:indexPath]];
}
}
Replies
SlickShopper 2 | BTIConcepts on GitHub | Free NSLog utility | Free Getter Utility | Leave a PayPal donation.
Are you a newbie? Things you should read:
Definitive Guide To Properties | UITableView Series | A Model (Object) Is A Beautiful Thing
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesome- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like AwesomeSlickShopper 2 | BTIConcepts on GitHub | Free NSLog utility | Free Getter Utility | Leave a PayPal donation.
Are you a newbie? Things you should read:
Definitive Guide To Properties | UITableView Series | A Model (Object) Is A Beautiful Thing
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like AwesomeThe behavior of it, well, when tapping the edit button, a UIButton placed on the custom cell is active to respond to a tap. When the user taps on it the cell should be deleted. That part is okay. The part that isn't working is when tapping the edit button, its not settings a particular image to the UIImageView on all the cells. Its only appearing on one of them.
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like AwesomeSlickShopper 2 | BTIConcepts on GitHub | Free NSLog utility | Free Getter Utility | Leave a PayPal donation.
Are you a newbie? Things you should read:
Definitive Guide To Properties | UITableView Series | A Model (Object) Is A Beautiful Thing
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesome- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like AwesomeLet the view controller worry about deleting the cells. Rig your button to talk to the view controller, and then the view controller can figure out which cell that is and delete the appropriate row.
You should be overriding setEditing:animated: in your cell subclass to achieve the behavior that you want.
SlickShopper 2 | BTIConcepts on GitHub | Free NSLog utility | Free Getter Utility | Leave a PayPal donation.
Are you a newbie? Things you should read:
Definitive Guide To Properties | UITableView Series | A Model (Object) Is A Beautiful Thing
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesome- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesome