如何更改ios 7上的重新排序控制图像

前端之家收集整理的这篇文章主要介绍了如何更改ios 7上的重新排序控制图像前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在寻找一种方法来改变重新排序控制图像和大小.

我使用此代码更改重新排序图像:

-(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,30,24);
                    ((UIImageView*)someObj).image = img;
                }
            }
        }
    }
}

代码在iOS 6上完美运行,但不适用于iOS 7.

我怎样才能解决这个问题?有没有其他方法来改变重新排序控制图像?

解决方法

尝试

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
                                        }

                                    }
                                }
                            }
                        }
                    }
                }
            }
        }

猜你在找的Xcode相关文章