Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Customize commit editing style delete button in UITableViewCell

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 1.69k
    Comment on it

    Hello All,

    Following lines of code will customize the delete button in UITableView editing style.
    This is an override method of UITableViewCell which is called when UITableView goes in editing mode.
    So to customize the delete button in UITableView editing style use this override method in your Custom UITableViewCell.

    - (void)willTransitionToState:(UITableViewCellStateMask)state
    {
        [super willTransitionToState:state];
        if ((state & UITableViewCellStateShowingDeleteConfirmationMask) == UITableViewCellStateShowingDeleteConfirmationMask)
        {
    
                for (UIView *subview in self.subviews)
                {
                    NSLog(@"mmmmmmm22222 %@",subview);
                    if ([NSStringFromClass([subview class]) isEqualToString:@"UITableViewCellScrollView"])
                    {
                        CGRect frame = subview.frame;
                        UIView *view = [[UIView alloc]initWithFrame:CGRectMake(frame.size.width+frame.origin.x, 0, 150, frame.size.height)];
                        [view setBackgroundColor:[UIColor colorWithRed:(142.00/255.00) green:(178.00/255.00) blue:(217.00/255.00) alpha:1]];
                        UIImageView *imageView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"trash_icon"]];
                        [imageView setFrame:CGRectMake(20, (view.frame.size.height-32)/2, 26, 32)];
                        [view addSubview:imageView];
                    }
                }
    
            }
    }
    

    Happy coding.....

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: