Ios 获取动态更改的UITableViewCell内视图的高度
我制作了一个自定义UIView,在上面做了一些动画。 我需要计算它的帧大小,因为它在iPhone 6、6 plus和iPhone 5中有所不同 我正在使用Ios 获取动态更改的UITableViewCell内视图的高度,ios,uitableview,Ios,Uitableview,我制作了一个自定义UIView,在上面做了一些动画。 我需要计算它的帧大小,因为它在iPhone 6、6 plus和iPhone 5中有所不同 我正在使用 self.frame, self.layer.presentationlayer.frame 但是他们都给出了错误的帧,我需要在视图出现在单元格内后的帧。 在cellforrowatinexpath中,我调用这个函数 [cell.answer1 showStatistics:percent]; 用我第一次做的方法 CGRect Fra
self.frame, self.layer.presentationlayer.frame
但是他们都给出了错误的帧,我需要在视图出现在单元格内后的帧。
在cellforrowatinexpath中,我调用这个函数
[cell.answer1 showStatistics:percent];
用我第一次做的方法
CGRect Frame= self.frame;
dempedLayer=[[UIView alloc] initWithFrame:Frame];
[dempedLayer setBackgroundColor:[UIColor blackColor]];
[dempedLayer setAlpha:0.35];
[self addSubview:dempedLayer];
然后我用CAShapeLayer和CABasicAnimation制作了一些动画
CABasicAnimation *rotationAnimation=[CABasicAnimation animationWithKeyPath:@"strokeEnd"]
如果您正在尝试制作动画,这里是如何实现的:-
[UIView animateWithDuration:0.5 animations^{
CGRect viewFrame = self.yourView.frame;
viewFrame.size.height += 100;
self.yourView.frame = viewFrame;
}];
如果这不是您想要的,可能是您应该检查您在IB/故事板中设置的自动调整大小参数。您能在调用这些方法的地方发布一段代码,以便我们可以查看您的视图的外观吗like@SteBra我将代码设置为UITableViewCell的类方法(如果单元格是自定义的)然后在视图控制器的heightForRowAtIndexPath中,调用该方法根据其数据获取单元格高度。实际上,我使用的是CABasicAnimation*rotationAnimation=[CABasicAnimation animationWithKeyPath:@“strokeEnd”]