我正在寻找一种方法来更改重新排序控件的图像和大小。
我正在使用以下代码来更改重新排序图像:
-(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上则无效。
我怎样才能解决这个问题?还有其他方法可以更改重新订购控制图像吗?
尝试
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
}
}
}
}
}
}
}
}
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句