보기의 맨 아래에 하나의 UITextView가 있습니다. 사용자가 동영상을 탭하면보기가 150 픽셀 위로 움직여야합니다. 내가 사용하고 있습니다 :UITextView 애니메이션보기 후 잘못된 내용 오프셋
- (void)textViewDidBeginEditing:(UITextView *)textView{
및
- (void)textViewDidEndEditing:(UITextView *)textView{
이 할 수 있습니다.
iOS5에서 정상적으로 작동합니다. 그러나 iOS 4.3에서는 뷰가 애니메이션으로 처리 될 때이 UITextView의 내용이 약간 픽셀 씩 올라갑니다.
스크린 샷 : 비슷한 문제가 있었다 http://cl.ly/1q3e0W2G1M000u1U3w1f
누군가?
코드 :
- (void)textViewDidBeginEditing:(UITextView *)textView{
if([textView.text isEqualToString:@"Placeholder text"]){
textView.text = @"";
}
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDelegate:self];
[UIView setAnimationDuration:0.3];
[UIView setAnimationBeginsFromCurrentState:YES];
self.view.frame = CGRectMake(self.view.frame.origin.x, (self.view.frame.origin.y - 150.0), self.view.frame.size.width, self.view.frame.size.height);
[UIView commitAnimations];
}
- (void)textViewDidEndEditing:(UITextView *)textView{
if([textView.text isEqualToString:@""]){
textView.text = @"Placeholder text";
}
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDelegate:self];
[UIView setAnimationDuration:0.3];
[UIView setAnimationBeginsFromCurrentState:YES];
self.view.frame = CGRectMake(self.view.frame.origin.x, (self.view.frame.origin.y + 150.0), self.view.frame.size.width, self.view.frame.size.height);
[UIView commitAnimations];
}
이 코드를 어디에 넣어야합니까? – dormitkon
감사합니다! 상수'UIEdgeInsetsZero'를 사용할 수도 있습니다. – colincameron