Ios 需要在滚动底部列表的同时移动顶部的红色选择器
我需要移动上面显示的红色选择器以及底部水平滚动视图。目前,它是在滚动完成后发生的 以下是我正在使用的代码:Ios 需要在滚动底部列表的同时移动顶部的红色选择器,ios,objective-c,cocoa-touch,uiscrollview,uiscrollviewdelegate,Ios,Objective C,Cocoa Touch,Uiscrollview,Uiscrollviewdelegate,我需要移动上面显示的红色选择器以及底部水平滚动视图。目前,它是在滚动完成后发生的 以下是我正在使用的代码: - (void)scrollViewDidEndDecelerating1:(UIScrollView *)scrollView { if (scrollView.contentOffset.x == 0) { [UIView animateWithDuration:0.25 animations:^{ self.selectMessageC
- (void)scrollViewDidEndDecelerating1:(UIScrollView *)scrollView {
if (scrollView.contentOffset.x == 0) {
[UIView animateWithDuration:0.25 animations:^{
self.selectMessageCatagoriesLabel.frame = CGRectMake(0, 41, [CommonUtils getFlexibleWidth:125], 3);
} completion:^(BOOL finished) {
}];
}
else if (scrollView.contentOffset.x == 375) {
[UIView animateWithDuration:0.25 animations:^{
self.selectMessageCatagoriesLabel.frame = CGRectMake([CommonUtils getFlexibleWidth:125], 41, [CommonUtils getFlexibleWidth:125], 3);
} completion:^(BOOL finished) {
}];
}
else{
[UIView animateWithDuration:0.25 animations:^{
self.selectMessageCatagoriesLabel.frame = CGRectMake([CommonUtils getFlexibleWidth:250], 41, [CommonUtils getFlexibleWidth:125], 3);
} completion:^(BOOL finished) {
}];
}
}
请查看屏幕截图以获取参考
您可以使用
UIScrollViewDelegate
中的scrollViewDidScroll
方法,因此您可以将代码移动到此方法中。在这种方法中不需要使用动画,因为它调用非常频繁