그래서이 uiscrollerview가 있습니다 ... 매 5 초가 지나면 scrollview가 위로 이동해야합니다.보기에서 스크롤 애니메이션을 만드는 방법
setcontentoffset이 작동하지만 애니메이션이 없습니다. 천천히 움직여야하는 것처럼. 사전
그래서이 uiscrollerview가 있습니다 ... 매 5 초가 지나면 scrollview가 위로 이동해야합니다.보기에서 스크롤 애니메이션을 만드는 방법
setcontentoffset이 작동하지만 애니메이션이 없습니다. 천천히 움직여야하는 것처럼. 사전
[UIView animationWithDuration0.3f ^(void) {
// code to do the transition
}];
[scrollView setContentOffset:offset animated:YES];
작동하지 않습니다 ... [UIView animationWithDuration : 0.3f^(void) { [scroll setContentOffset : bottomOffset 애니메이션 : 예]; }]]; – antonoVodka
두 가지 옵션이 있습니다 .... 하나 또는 다른 것을 할 수 있습니다 [UIView animationWithDuration0.3f^(void) { [scroll setContentOffSet : offSet]; }]]; 또는 [scrollView setContentOffset : offset animated : YES]; –
'[UIView animateWithDuration : 1.00f 지연 : 0.0f 옵션 : UIViewAnimationOptionCurveEaseOut 애니메이션 :^{ [scroll setContentOffset : bottomOffset]; } 완료 :^(BOOL 완료) { }]; ' – antonoVodka
에서
CGPoint bottomOffset = CGPointMake(0, newYLocationForScrollView);
[scroll setContentOffset:bottomOffset animated:YES];
덕분에 아래
내 코드는 당신이 찾고있는 방법은 scrollRectToVisible:animated:
입니다. 자세한 내용이 없으면 원하는 직각을 계산할 코드를 남겨 두어야합니다.
사용있는 ScrollView scrollRectToVisible:animated:
방법 및 제공 animated
재산 YES
또는
[UIView animateWithDuration:1.2f animations:^{
/// write code for animation
}];
작동하지 않습니다 ... [UIView animationWithDuration : 0.3f^(void) { [scroll setContentOffset : bottomOffset animated : YES]; }]]; – antonoVodka
[scroll setContentOffset : bottomOffset animated : YES]; 이 메서드를 애니메이션 "YES"로 사용하면 다른 애니메이션을 사용할 필요가 없습니다.이 메서드는 자체 애니메이션을가집니다. – iPatel
어떻게 ScrollView 코드를 여기에 스크롤 할 수 있습니까? – iPatel
[scrollView setContentOffset : offset animated : YES]; –