| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399 |
- //The MIT License (MIT)
- //
- //Copyright (c) 2013 Rafał Augustyniak
- //
- //Permission is hereby granted, free of charge, to any person obtaining a copy of
- //this software and associated documentation files (the "Software"), to deal in
- //the Software without restriction, including without limitation the rights to
- //use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
- //the Software, and to permit persons to whom the Software is furnished to do so,
- //subject to the following conditions:
- //
- //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- //IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
- //FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
- //COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- //IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- //CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- //
- #import "RATreeView+UIScrollView.h"
- #import "RATreeView+Private.h"
- @implementation RATreeView (UIScrollView)
- #pragma clang diagnostic push
- #pragma clang diagnostic ignored "-Wobjc-protocol-method-implementation"
- #pragma mark Managing the Display of Content
- - (void)setContentOffset:(CGPoint)contentOffset
- {
- self.tableView.contentOffset = contentOffset;
- }
- - (CGPoint)contentOffset
- {
- return self.tableView.contentOffset;
- }
- - (void)setContentSize:(CGSize)contentSize
- {
- self.tableView.contentSize = contentSize;
- }
- - (CGSize)contentSize
- {
- return self.tableView.contentSize;
- }
- - (void)setContentInset:(UIEdgeInsets)contentInset
- {
- self.tableView.contentInset = contentInset;
- }
- - (UIEdgeInsets)contentInset
- {
- return self.tableView.contentInset;
- }
- #pragma mark Managing Scrolling
- - (void)setScrollEnabled:(BOOL)scrollEnabled
- {
- self.tableView.scrollEnabled = scrollEnabled;
- }
- - (BOOL)scrollEnabled
- {
- return self.tableView.scrollEnabled;
- }
- - (void)setDirectionalLockEnabled:(BOOL)directionalLockEnabled
- {
- self.tableView.directionalLockEnabled = directionalLockEnabled;
- }
- - (BOOL)directionalLockEnabled
- {
- return self.tableView.directionalLockEnabled;
- }
- - (void)setScrollsToTop:(BOOL)scrollsToTop
- {
- self.tableView.scrollsToTop = scrollsToTop;
- }
- -(BOOL)scrollsToTop
- {
- return self.tableView.scrollsToTop;
- }
- - (void)setPagingEnabled:(BOOL)pagingEnabled
- {
- self.tableView.pagingEnabled = pagingEnabled;
- }
- - (BOOL)pagingEnabled
- {
- return self.tableView.pagingEnabled;
- }
- - (void)setBounces:(BOOL)bounces
- {
- self.tableView.bounces = bounces;
- }
- - (BOOL)bounces
- {
- return self.tableView.bounces;
- }
- - (void)setAlwaysBounceVertical:(BOOL)alwaysBounceVertical
- {
- self.tableView.alwaysBounceVertical = alwaysBounceVertical;
- }
- - (BOOL)alwaysBounceVertical
- {
- return self.tableView.alwaysBounceVertical;
- }
- - (void)setAlwaysBounceHorizontal:(BOOL)alwaysBounceHorizontal
- {
- self.tableView.alwaysBounceHorizontal = alwaysBounceHorizontal;
- }
- - (BOOL)alwaysBounceHorizontal
- {
- return self.tableView.alwaysBounceHorizontal;
- }
- - (void)setCanCancelContentTouches:(BOOL)canCancelContentTouches
- {
- self.tableView.canCancelContentTouches = canCancelContentTouches;
- }
- - (BOOL)canCancelContentTouches
- {
- return self.tableView.canCancelContentTouches;
- }
- - (void)setDelaysContentTouches:(BOOL)delaysContentTouches
- {
- self.tableView.delaysContentTouches = delaysContentTouches;
- }
- - (BOOL)delaysContentTouches
- {
- return self.tableView.delaysContentTouches;
- }
- - (void)setDecelerationRate:(BOOL)decelerationRate
- {
- self.tableView.decelerationRate = decelerationRate;
- }
- - (BOOL)decelerationRate
- {
- return self.tableView.decelerationRate;
- }
- - (BOOL)dragging
- {
- return self.tableView.dragging;
- }
- - (BOOL)tracking
- {
- return self.tableView.tracking;
- }
- - (BOOL)decelerating
- {
- return self.tableView.decelerating;
- }
- #pragma mark Managin the Scroll Indicator
- - (void)setIndicatorStyle:(UIScrollViewIndicatorStyle)indicatorStyle
- {
- self.tableView.indicatorStyle = indicatorStyle;
- }
- - (UIScrollViewIndicatorStyle)indicatorStyle
- {
- return self.tableView.indicatorStyle;
- }
- //
- //- (void)setScrollIndicatorInsets:(UIEdgeInsets)scrollIndicatorInsets
- //{
- // self.tableView.scrollIndicatorInsets = scrollIndicatorInsets;
- //}
- //
- //- (UIEdgeInsets)scrollIndicatorInsets
- //{
- // return self.tableView.scrollIndicatorInsets;
- //}
- - (void)setShowsHorizontalScrollIndicator:(BOOL)showsHorizontalScrollIndicator
- {
- self.tableView.showsHorizontalScrollIndicator = showsHorizontalScrollIndicator;
- }
- - (BOOL)showsHorizontalScrollIndicator
- {
- return self.tableView.showsHorizontalScrollIndicator;
- }
- - (void)setShowsVerticalScrollIndicator:(BOOL)showsVerticalScrollIndicator
- {
- self.tableView.showsVerticalScrollIndicator = showsVerticalScrollIndicator;
- }
- - (BOOL)showsVerticalScrollIndicator
- {
- return self.tableView.showsVerticalScrollIndicator;
- }
- #pragma mark Zooming and Panning
- - (UIPanGestureRecognizer *)panGestureRecognizer
- {
- return self.panGestureRecognizer;
- }
- - (UIPinchGestureRecognizer *)pinchGestureRecognizer
- {
- return self.pinchGestureRecognizer;
- }
- - (void)setZoomScale:(CGFloat)zoomScale
- {
- self.tableView.zoomScale = zoomScale;
- }
- - (CGFloat)zoomScale
- {
- return self.tableView.zoomScale;
- }
- - (void)setMaximumZoomScale:(CGFloat)maximumZoomScale
- {
- self.tableView.maximumZoomScale = maximumZoomScale;
- }
- - (CGFloat)maximumZoomScale
- {
- return self.tableView.maximumZoomScale;
- }
- - (void)setMinimumZoomScale:(CGFloat)minimumZoomScale
- {
- self.tableView.minimumZoomScale = minimumZoomScale;
- }
- - (CGFloat)minimumZoomScale
- {
- return self.tableView.minimumZoomScale;
- }
- - (BOOL)zoomBouncing
- {
- return self.tableView.zoomBouncing;
- }
- - (BOOL)zooming
- {
- return self.tableView.zooming;
- }
- - (void)setBouncesZoom:(BOOL)bouncesZoom
- {
- self.tableView.bouncesZoom = bouncesZoom;
- }
- - (BOOL)bouncesZoom
- {
- return self.tableView.bouncesZoom;
- }
- #pragma mark Responding to Scrolling and Dragging
- - (void)scrollViewDidScroll:(UIScrollView *)scrollView
- {
- if ([self.delegate respondsToSelector:@selector(scrollViewDidScroll:)]) {
- [self.delegate scrollViewDidScroll:scrollView];
- }
- }
- - (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView
- {
- if ([self.delegate respondsToSelector:@selector(scrollViewWillBeginDragging:)]) {
- [self.delegate scrollViewWillBeginDragging:scrollView];
- }
- }
- - (void)scrollViewWillEndDragging:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity targetContentOffset:(inout CGPoint *)targetContentOffset
- {
- if ([self.delegate respondsToSelector:@selector(scrollViewWillEndDragging:withVelocity:targetContentOffset:)]) {
- [self.delegate scrollViewWillEndDragging:scrollView withVelocity:velocity targetContentOffset:targetContentOffset];
- }
- }
- - (BOOL)scrollViewShouldScrollToTop:(UIScrollView *)scrollView
- {
- if ([self.delegate respondsToSelector:@selector(scrollViewShouldScrollToTop:)]) {
- return [self.delegate scrollViewShouldScrollToTop:scrollView];
- }
- return YES;
- }
- - (void)scrollViewDidScrollToTop:(UIScrollView *)scrollView
- {
- if ([self.delegate respondsToSelector:@selector(scrollViewDidScroll:)]) {
- [self.delegate scrollViewDidScroll:scrollView];
- }
- }
- - (void)scrollViewWillBeginDecelerating:(UIScrollView *)scrollView
- {
- if ([self.delegate respondsToSelector:@selector(scrollViewWillBeginDecelerating:)]) {
- [self.delegate scrollViewWillBeginDecelerating:scrollView];
- }
- }
- - (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView
- {
- if ([self.delegate respondsToSelector:@selector(scrollViewDidEndDecelerating:)]) {
- [self.delegate scrollViewDidEndDecelerating:scrollView];
- }
- }
- //Managing Zooming
- - (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView
- {
- if ([self.delegate respondsToSelector:@selector(viewForZoomingInScrollView:)]) {
- return [self.delegate viewForZoomingInScrollView:scrollView];
- }
- return nil;
- }
- - (void)scrollViewWillBeginZooming:(UIScrollView *)scrollView withView:(UIView *)view
- {
- if ([self.delegate respondsToSelector:@selector(scrollViewWillBeginZooming:withView:)]) {
- [self.delegate scrollViewWillBeginZooming:scrollView withView:view];
- }
- }
- - (void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:(UIView *)view atScale:(float)scale
- {
- if ([self.delegate respondsToSelector:@selector(scrollViewDidEndZooming:withView:atScale:)]) {
- [self.delegate scrollViewDidEndZooming:scrollView withView:view atScale:scale];
- }
- }
- - (void)scrollViewDidZoom:(UIScrollView *)scrollView
- {
- if ([self.delegate respondsToSelector:@selector(scrollViewDidZoom:)]) {
- [self.delegate scrollViewDidZoom:scrollView];
- }
- }
- //Responding and Scrolling Animations
- - (void)scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView
- {
- if ([self.delegate respondsToSelector:@selector(scrollViewDidEndScrollingAnimation:)]) {
- [self.delegate scrollViewDidEndScrollingAnimation:scrollView];
- }
- }
- #pragma clang diagnostic pop
- @end
|