一、功能效果GIF图:
二、实现代码
-(void)arrowButtonTouched
{
//移动到最右侧
CGFloat offsetW =self.scrollView.contentSize.width - [UIScreen mainScreen].bounds.size.width;
if(offsetW>0) {
ok_MainThread(^{
[self.scrollView setContentOffset:CGPointMake(offsetW,0) animated:YES];
});}}
//宏定义-封装:
#define ok_MainThread(block)\
if ([NSThread isMainThread]) {\
block();\
} else {\
dispatch_async(dispatch_get_main_queue(), block);\
}