如何更改ios 7上的重新排序控制图像 [英] How to change Reorder Control image on ios 7

查看:86
本文介绍了如何更改ios 7上的重新排序控制图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一种方法来更改重新排序控制图像和尺寸。

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

我使用此代码更改重新订购图片:

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;
                }
            }
        }
    }
} 

此代码在iOS 6上完美运行,但在iOS 7上无效。

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?

推荐答案

尝试

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
                                        }

                                    }
                                }
                            }
                        }
                    }
                }
            }
        }

这篇关于如何更改ios 7上的重新排序控制图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆