【发布时间】:2020-02-29 01:00:28
【问题描述】:
我需要将上面显示的红色选择器连同底部的水平滚动视图一起移动。目前它是在滚动完成后发生的。
这是我正在使用的代码:
- (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) {
}];
}
}
请查看截图以获取参考
【问题讨论】:
标签: ios objective-c cocoa-touch uiscrollview uiscrollviewdelegate