From 7b02207537d35bfa1714bf8beafc921f717d100a Mon Sep 17 00:00:00 2001 From: 单军华 Date: Wed, 11 Jul 2018 10:47:42 +0800 Subject: [PATCH] 首次上传 --- screendisplay/Pods/YYCategories/YYCategories/UIKit/UIScrollView+YYAdd.m | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 60 insertions(+), 0 deletions(-) diff --git a/screendisplay/Pods/YYCategories/YYCategories/UIKit/UIScrollView+YYAdd.m b/screendisplay/Pods/YYCategories/YYCategories/UIKit/UIScrollView+YYAdd.m new file mode 100755 index 0000000..766105a --- /dev/null +++ b/screendisplay/Pods/YYCategories/YYCategories/UIKit/UIScrollView+YYAdd.m @@ -0,0 +1,60 @@ +// +// UIScrollView+YYAdd.m +// YYCategories <https://github.com/ibireme/YYCategories> +// +// Created by ibireme on 13/4/5. +// Copyright (c) 2015 ibireme. +// +// This source code is licensed under the MIT-style license found in the +// LICENSE file in the root directory of this source tree. +// + +#import "UIScrollView+YYAdd.h" +#import "YYCategoriesMacro.h" + +YYSYNTH_DUMMY_CLASS(UIScrollView_YYAdd) + + +@implementation UIScrollView (YYAdd) + +- (void)scrollToTop { + [self scrollToTopAnimated:YES]; +} + +- (void)scrollToBottom { + [self scrollToBottomAnimated:YES]; +} + +- (void)scrollToLeft { + [self scrollToLeftAnimated:YES]; +} + +- (void)scrollToRight { + [self scrollToRightAnimated:YES]; +} + +- (void)scrollToTopAnimated:(BOOL)animated { + CGPoint off = self.contentOffset; + off.y = 0 - self.contentInset.top; + [self setContentOffset:off animated:animated]; +} + +- (void)scrollToBottomAnimated:(BOOL)animated { + CGPoint off = self.contentOffset; + off.y = self.contentSize.height - self.bounds.size.height + self.contentInset.bottom; + [self setContentOffset:off animated:animated]; +} + +- (void)scrollToLeftAnimated:(BOOL)animated { + CGPoint off = self.contentOffset; + off.x = 0 - self.contentInset.left; + [self setContentOffset:off animated:animated]; +} + +- (void)scrollToRightAnimated:(BOOL)animated { + CGPoint off = self.contentOffset; + off.x = self.contentSize.width - self.bounds.size.width + self.contentInset.right; + [self setContentOffset:off animated:animated]; +} + +@end -- Gitblit v1.8.0