// // BGSwipeView.h // BuguLive // // Created by 朱庆彬 on 2017/8/16. // Copyright © 2017年 xfg. All rights reserved. // #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wauto-import" #pragma GCC diagnostic ignored "-Wobjc-missing-property-synthesis" #import #undef weak_delegate #if __has_feature(objc_arc) && __has_feature(objc_arc_weak) #define weak_delegate weak #else #define weak_delegate unsafe_unretained #endif #import typedef NS_ENUM(NSUInteger, FWSwipeViewAlignment) { FWSwipeViewAlignmentEdge = 0, FWSwipeViewAlignmentCenter }; @protocol FWSwipeViewDataSource , FWSwipeViewDelegate; @interface BGSwipeView : UIView @property (nonatomic, weak_delegate) IBOutlet id dataSource; @property (nonatomic, weak_delegate) IBOutlet id delegate; @property (nonatomic, readonly) NSInteger numberOfItems; @property (nonatomic, readonly) NSInteger numberOfPages; @property (nonatomic, readonly) CGSize itemSize; @property (nonatomic, assign) NSInteger itemsPerPage; @property (nonatomic, assign) BOOL truncateFinalPage; @property (nonatomic, strong, readonly) NSArray *indexesForVisibleItems; @property (nonatomic, strong, readonly) NSArray *visibleItemViews; @property (nonatomic, strong, readonly) UIView *currentItemView; @property (nonatomic, assign) NSInteger currentItemIndex; @property (nonatomic, assign) NSInteger currentPage; @property (nonatomic, assign) FWSwipeViewAlignment alignment; @property (nonatomic, assign) CGFloat scrollOffset; @property (nonatomic, assign, getter=isPagingEnabled) BOOL pagingEnabled; @property (nonatomic, assign, getter=isScrollEnabled) BOOL scrollEnabled; @property (nonatomic, assign, getter=isWrapEnabled) BOOL wrapEnabled; @property (nonatomic, assign) BOOL delaysContentTouches; @property (nonatomic, assign) BOOL bounces; @property (nonatomic, assign) float decelerationRate; @property (nonatomic, assign) CGFloat autoscroll; @property (nonatomic, readonly, getter=isDragging) BOOL dragging; @property (nonatomic, readonly, getter=isDecelerating) BOOL decelerating; @property (nonatomic, readonly, getter=isScrolling) BOOL scrolling; @property (nonatomic, assign) BOOL defersItemViewLoading; @property (nonatomic, assign, getter=isVertical) BOOL vertical; - (void)reloadData; - (void)reloadItemAtIndex:(NSInteger)index; - (void)scrollByOffset:(CGFloat)offset duration:(NSTimeInterval)duration; - (void)scrollToOffset:(CGFloat)offset duration:(NSTimeInterval)duration; - (void)scrollByNumberOfItems:(NSInteger)itemCount duration:(NSTimeInterval)duration; - (void)scrollToItemAtIndex:(NSInteger)index duration:(NSTimeInterval)duration; - (void)scrollToPage:(NSInteger)page duration:(NSTimeInterval)duration; - (UIView *)itemViewAtIndex:(NSInteger)index; - (NSInteger)indexOfItemView:(UIView *)view; - (NSInteger)indexOfItemViewOrSubview:(UIView *)view; @end @protocol FWSwipeViewDataSource - (NSInteger)numberOfItemsInFWSwipeView:(BGSwipeView *)swipeView; - (UIView *)swipeView:(BGSwipeView *)swipeView viewForItemAtIndex:(NSInteger)index reusingView:(UIView *)view; @end @protocol FWSwipeViewDelegate @optional - (CGSize)swipeViewItemSize:(BGSwipeView *)swipeView; - (void)swipeViewDidScroll:(BGSwipeView *)swipeView; - (void)swipeViewCurrentItemIndexDidChange:(BGSwipeView *)swipeView; - (void)swipeViewWillBeginDragging:(BGSwipeView *)swipeView; - (void)swipeViewDidEndDragging:(BGSwipeView *)swipeView willDecelerate:(BOOL)decelerate; - (void)swipeViewWillBeginDecelerating:(BGSwipeView *)swipeView; - (void)swipeViewDidEndDecelerating:(BGSwipeView *)swipeView; - (void)swipeViewDidEndScrollingAnimation:(BGSwipeView *)swipeView; - (BOOL)swipeView:(BGSwipeView *)swipeView shouldSelectItemAtIndex:(NSInteger)index; - (void)swipeView:(BGSwipeView *)swipeView didSelectItemAtIndex:(NSInteger)index; @end #pragma GCC diagnostic pop