我有这样的场景:当我点击UITextView时,它会展开或缩小。但每次UITextView缩小时,内容都会向下滚动到底部。
我试过
[textView setContentOffset:CGPointZero animated:YES];
textView.scrollsToTop = YES;
但它们都不起作用。
以下是截图:
以下是代码:
- (IBAction)tapText:(id)sender {
NSLog(@"tap text view");
[self addBoundsSpringAnimationToView:self.movieTextView];
}
- (void) addBoundsSpringAnimationToView:(UITextView *)textView {
POPSpringAnimation *anim = [POPSpringAnimation animationWithPropertyNamed:kPOPLayerBounds];
if (expand) {
NSLog(@"expand");
self.bgUIImageView.hidden = YES;
self.blurredImageView.hidden = NO;
anim.toValue = [NSValue valueWithCGRect:CGRectMake(0, 0.0f, 320.0f, 807.0f)];
anim.springBounciness = 18;
} else {
NSLog(@"Shrink");
self.bgUIImageView.hidden = NO;
self.blurredImageView.hidden = YES;
anim.toValue = [NSValue valueWithCGRect:CGRectMake(0, 355.0f, 320.0f, 225.0f)];
}
expand = !expand;
anim.springSpeed = 10;
[textView pop_addAnimation:anim forKey:@"popBounds"];
}
它与Facebook Pop动画有关吗?
谢谢!