Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xcode/7.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 将动画限制为父视图_Ios_Animation_Uiview_Uitableview - Fatal编程技术网

Ios 将动画限制为父视图

Ios 将动画限制为父视图,ios,animation,uiview,uitableview,Ios,Animation,Uiview,Uitableview,我有一个UITableViewCell,我会将它的内容制作成动画。但是我想限制动画,以便当文本超出UITableViewCell时,它在ViewController中不可见 动画本身很简单: [UIView animateWithDuration:0.3 delay:0 options:0 animations:^ { yesNew.origin.x += 200; noNew.origin.x += 200; ansLblNew.origin

我有一个UITableViewCell,我会将它的内容制作成动画。但是我想限制动画,以便当文本超出UITableViewCell时,它在ViewController中不可见

动画本身很简单:

[UIView animateWithDuration:0.3 delay:0 options:0 animations:^
     {
       yesNew.origin.x += 200;
       noNew.origin.x += 200;
       ansLblNew.origin.x = -210;

      [yesButton setFrame:yesNew];
       [noButton setFrame:noNew];
       [answerLabel setFrame:ansLblNew];

     }completion:^(BOOL finished){
       [yesButton setHidden:YES];
       [noButton setHidden:YES];
       [answerLabel setHidden:YES];
     }];

尝试将单元格的clipToBounds设置为YES(如果您是在代码中执行的),或者选中IB中的“Clip Subview”复选框(在属性检查器的“视图”部分)。

如何将这些子视图添加到
UITableViewCell
?是否将它们添加到
单元格。contentView
?如果是这样,您应该能够设置
cell.contentView.clipsToBounds=YES
。过去,当我试图在单元格本身上设置
clipstobunds
时,我遇到过奇怪的行为。或者,您是否尝试过设置myTableView.clipsToBounds=YES?这是未经测试的,但可能会奏效。

不起作用。。我做到了:cell.clipstobunds=是;,我应该将剪辑添加到绑定到每个项目的动画中吗?好吧,这不应该是正确的。我也尝试过这个(两个),不起作用:/我自己不添加它们,它们是从情节提要添加的,我访问cellforrowatindexpath中的by标记