123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- #import <objc/runtime.h>
- #import "UIScrollView+TOScrollBar.h"
- #import "TOScrollBar.h"
- static void * TOScrollBarPropertyKey = &TOScrollBarPropertyKey;
- @implementation UIScrollView (TOScrollBar)
- - (TOScrollBar *)to_scrollBar
- {
- return objc_getAssociatedObject(self, TOScrollBarPropertyKey);
- }
- - (void)setTo_scrollBar:(TOScrollBar *)scrollBar
- {
- objc_setAssociatedObject(self, TOScrollBarPropertyKey, scrollBar, OBJC_ASSOCIATION_RETAIN);
- }
- - (void)to_addScrollBar:(TOScrollBar *)scrollBar
- {
- [scrollBar addToScrollView:self];
- }
- - (void)to_removeScrollbar
- {
- [self.to_scrollBar removeFromScrollView];
- }
- @end
|