在我们的问题模块中,当用户点击由tableview表示的答案时,我需要调整UIView的大小和动画。我已经阅读了一些相关问题并应用了他们的解决方案,但没有一个能为我工作。
问题是uiview没有出现在第一次点击,但如果用户点击相同的答案2次或更多,它会出现,因为在第二次点击相同的答案时不会改变框架。
所以基本上如果答案的反馈改变了,uiview的高度将被重新计算,我猜它是阻挡动画。
我的视图层次结构: http://i.imgur.com/Oho6Hob.png
更改视图和textview约束的方法:
self.feedbackLabelWrapperHeight.constant = height + 45;
self.feedbackViewHeight.constant = height + 45 + 12;
int y = height;
[self.feedbackView setFrame:CGRectMake(50,self.scrollView.frame.size.height + self.scrollView.frame.origin.y -(y+40),self.feedbackView.frame.size.width,(y+40))];
动画方法:
[UIView beginAnimations:@"feedback" context:NULL];
[UIView setAnimationBeginsFromCurrentState:YES];
[UIView setAnimationDuration:0.2];
[UIView setAnimationDelay:delay];
[self.view layoutIfNeeded];
[UIView commitAnimations];
self.isFeedbackViewVisiable = YES;
我按照以下顺序在didSelectRowAtIndexPath方法中调用这两个方法: 和labelHeightOfResponse参数是相关标签或textview的计算高度
[self setFeedbackConstraintHeight:labelHeightOfResponse];
[self feedbackViewAppearAnimationWithDelay:0.2 yPosition:labelHeightOfResponse];
我真的很感激这里的帮助。 谢谢!
答案 0 :(得分:2)