1

I have seen how to do in this link.

I followed and implement in my view controller where it has tableview and other subview. Tableview cell is implemented by custom cell.

Problem is that, I never see this "UITableViewCellDeleteConfirmationView" to change colour of UITableView cell delete button colour. I am writing on iOS7. So, is it different already? Or am I doing something wrong?

 -(void)viewWillLayoutSubviews
{
    [super viewWillLayoutSubviews];

    NSArray *subviews = [self.view subviews];

    // Return if there are no subviews
    if ([subviews count] == 0) return;

    for (UIView *subview1 in subviews)
    {
        NSLog(@"subview1 > %@",NSStringFromClass([subview1 class]));


        for(UIView *subview2 in subview1.subviews)
        {
            NSLog(@"subview2 > %@",NSStringFromClass([subview2 class]));


            for(UIView *subview3 in subview2.subviews)
            {
                NSLog(@"subview3 > %@",NSStringFromClass([subview3 class]));


                for(UIView *subview4 in subview3.subviews)
                {
                    NSLog(@"subview4 > %@",NSStringFromClass([subview4 class]));

                    for(UIView *subview5 in subview4.subviews)
                    {
                        NSLog(@"subview5 > %@",NSStringFromClass([subview5 class]));

                        for(UIView *subview6 in subview5.subviews)
                        {
                            NSLog(@"subview6 > %@",NSStringFromClass([subview6 class]));

                        }

                    }

                }


            }


            //
            //            if ([NSStringFromClass([subview2 class])     isEqualToString:@"UITableViewCellDeleteConfirmationView"])
            //            {
            //                //your color
            //                ((UIView*)[subview2.subviews firstObject]).backgroundColor=[UIColor blueColor];
            //                
            //                
            //            }
        }


    }

}
Community
  • 1
  • 1
Khant Thu Linn
  • 5,905
  • 7
  • 52
  • 120
  • 3
    Pro tip: If You want recursive list of subviews, make a breakpoint and in lldb enter: `po [self.view recursiveDescription]` – Mateusz Szlosek Jul 17 '14 at 08:04
  • viewWillLayoutSubviews is implemented in custom cell class right? – jithinroy Jul 17 '14 at 08:05
  • @jithinroy viewWillLayoutSubviews doesn't call in my custom cell class. I also check willTransitionToState in custom cell and it also doesn't give me UITableViewCellDeleteConfirmationView. – Khant Thu Linn Jul 17 '14 at 08:12

1 Answers1

2

Try in your custom cells class.

- (void)layoutSubviews
{
    [super layoutSubviews];
    for (UIView *subview in self.subviews) {

        for(UIView *subview2 in subview.subviews){
            if ([NSStringFromClass([subview2 class]) isEqualToString:@"UITableViewCellDeleteConfirmationView"]) {

                ((UIView*)[subview2.subviews firstObject]).backgroundColor=[UIColor yellowColor];
            }
        }
    }    
}
jithinroy
  • 1,885
  • 1
  • 16
  • 23