Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change Reorder Control image on ios 7

I'm looking for a way to change the reorder control image and size.

enter image description here

I've using this code to change the reorder image:

-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
    for (UIControl *control in cell.subviews)
    {
        if ([control isMemberOfClass:NSClassFromString(@"UITableViewCellReorderControl")] && [control.subviews count] > 0)
        {
            for (UIControl *someObj in control.subviews)
            {
                if ([someObj isMemberOfClass:[UIImageView class]])
                {
                    UIImage *img = [UIImage imageNamed:@"btn_move.png"];
                    ((UIImageView*)someObj).frame = CGRectMake(0, 0, 30, 24);
                    ((UIImageView*)someObj).image = img;
                }
            }
        }
    }
} 

This code works perfectly on iOS 6, but NOT on iOS 7.

How can i fix this? is there any other way to change the reorder control image?

like image 255
Sigalit Amsalem Yemini Avatar asked Feb 16 '23 05:02

Sigalit Amsalem Yemini


1 Answers

Try

for(UIView* view in self.table.subviews)
        {
            if([[[view class] description] isEqualToString:@"UITableViewWrapperView"])
            {
                for(UIView* viewTwo in view.subviews) {
                    if([[[viewTwo class] description] isEqualToString:@"UITableViewCell"]) {
                        for(UIView* viewThree in viewTwo.subviews) {
                            if([[[viewThree class] description] isEqualToString:@"UITableViewCellScrollView"]) {
                                for(UIView* viewFour in viewThree.subviews) {
                                    if([[[viewFour class] description] isEqualToString:@"UITableViewCellReorderControl"]) {
                                        for(UIImageView* viewFive in viewFour.subviews) {
                                            // your stuff here
                                        }

                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
like image 186
cujo30227 Avatar answered Feb 23 '23 09:02

cujo30227