Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/104.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 更改UITableViewCell';s减号动画_Ios_Objective C_Cocoa Touch_Uitableview - Fatal编程技术网

Ios 更改UITableViewCell';s减号动画

Ios 更改UITableViewCell';s减号动画,ios,objective-c,cocoa-touch,uitableview,Ios,Objective C,Cocoa Touch,Uitableview,我在编辑表视图时遇到问题: 我在编辑模式中将减号位置更改为单元格的右侧。 问题是按钮从左边滑动,使它看起来很奇怪。 有没有办法更改此动画 另外,撤销删除选项时会出现一个动画(显示红色删除按钮时单击减号),知道为什么吗 显示问题: ---编辑--- 这就是我改变立场的方式: - (void)layoutSubviews { [super layoutSubviews]; //Indent to the left instead of right self.contentView.frame =

我在编辑表视图时遇到问题:

我在编辑模式中将减号位置更改为单元格的右侧。
问题是按钮从左边滑动,使它看起来很奇怪。
有没有办法更改此动画

另外,撤销删除选项时会出现一个动画(显示红色删除按钮时单击减号),知道为什么吗

显示问题:

---编辑---
这就是我改变立场的方式:

- (void)layoutSubviews {
[super layoutSubviews];


//Indent to the left instead of right
self.contentView.frame = CGRectMake(0,
                                    self.contentView.frame.origin.y,
                                    self.contentView.frame.size.width,
                                    self.contentView.frame.size.height);

if ((self.editing
    && ((state & UITableViewCellStateShowingEditControlMask)
        && !(state & UITableViewCellStateShowingDeleteConfirmationMask))) ||
    ((state & UITableViewCellStateShowingEditControlMask)
     && (state & UITableViewCellStateShowingDeleteConfirmationMask)))
{
    float indentPoints = self.indentationLevel * self.indentationWidth;

    self.contentView.frame = CGRectMake(indentPoints - 35,
                                        self.contentView.frame.origin.y,
                                        self.contentView.frame.size.width - indentPoints,
                                        self.contentView.frame.size.height);
}

//Change editAccessoryView location
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationBeginsFromCurrentState:YES];
[UIView setAnimationDuration:0.0f];
//If can't use private classes (UITableViewCellDeleteConfirmationControl..), use [self.subviews objectAtIndex:0];

for (UIView *subview in self.subviews) {


    if ([NSStringFromClass([subview class]) isEqualToString:@"UITableViewCellDeleteConfirmationControl"]) {
        CGRect newFrame = subview.frame;
        newFrame.origin.x = 10;
        subview.frame = newFrame;
    }
    else if ([NSStringFromClass([subview class]) isEqualToString:@"UITableViewCellEditControl"]) {
        CGRect newFrame = subview.frame;
        newFrame.origin.x = 280;
        subview.frame = newFrame;

    }
    else if ([NSStringFromClass([subview class]) isEqualToString:@"UITableViewCellReorderControl"]) {
        CGRect newFrame = subview.frame;
        newFrame.origin.x = 200;
        subview.frame = newFrame;
    }
}
[UIView commitAnimations];

}

- (void)willTransitionToState:(UITableViewCellStateMask)aState {
[super willTransitionToState:aState];
self.state = aState;
}
---编辑2---
我发现引起减号跳跃问题的部分是
//更改editAccessoryView位置。
没有它,就不会跳跃,但减号按钮会回到单元格的左侧。

有什么办法吗?

只是一个猜测,但是你是否尝试过将视图颠倒过来?您可能可以使用
ui视图
转换

(来自互联网的代码,不确定其可靠性)


你是如何改变位置的?@MarcusAdams看到了我编辑过的答案。当他们最终国际化表格视图单元格时,你所做的任何事情都可能被破坏。也许你可以接受默认行为?我的自定义单元格设计为右侧,因此默认行为不适合我的需要。有没有更安全的方法来实现这一点?似乎自定义单元格控件的行为和可能性在iOS11中发生了重大变化。我的应用程序中的编辑控件也进行了重新定位,现在这些控件显示在标准位置,无论我如何布局:(它在10号模拟器上仍然可以正常工作,但在11号模拟器上不能正常工作……谢谢,这是个好主意,但整个单元格是颠倒的。你应该将它应用于删除控件视图,而不是整个单元格。哦,问题是我使用的是默认的删除控件,而不是自定义控件。你在自己的代码中遍历视图层次结构,因此你可以获得对删除控件的引用。)控制视图。
CGAffineTransform rotateTransform;
rotateTransform = CGAffineTransformRotate(CGAffineTransformIdentity, M_PI);
myView.transform = rotateTransform;