加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

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

发布时间:2020-12-14 18:03:31 所属栏目:百科 来源:网络整理
导读:我正在寻找一种方法来改变重新排序控制图像和大小. 我使用此代码更改重新排序图像: -(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{ for (UIControl *control in cell.su
我正在寻找一种方法来改变重新排序控制图像和大小.

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

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

                                    }
                                }
                            }
                        }
                    }
                }
            }
        }

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读