Skip to content

sheodon/SNPageView

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SNPageView

GitHub license Version Platform GitHub stars

分页滚动控件,可实现轮播(support page view and tab page view)by Objective-C

ScreenShots

##Installation

###Manually

  • clone this repo.
  • Simply drop the '/SNPageView' folder into your project.
  • import 'SNPageView.h'
  • import 'SNPageBar.h'
  • Enjoy!

###Cocoapods FTPopOverMenu is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "SNPageView"

SNPageView

SNPageView Delegate

@required
/// return page numbers
- (NSInteger) sn_pageViewForPageNumbers:(SNPageView *)pageView;
/// return UIView at index;
- (UIView*) sn_pageView:(SNPageView *)pageView viewAtIndex:(NSInteger)index;

@optional
/// called just one time
- (void) sn_pageView:(SNPageView *)pageView itemDidAppear:(SNPageViewItem *)item;
/// called just one time
- (void) sn_pageView:(SNPageView *)pageView itemDidDisappear:(SNPageViewItem *)item;
/// called many times
- (void) sn_pageView:(SNPageView *)pageView itemWillAppear:(SNPageViewItem *)item;
/// called many times
- (void) sn_pageView:(SNPageView *)pageView itemWillDisappear:(SNPageViewItem *)item;
/// called many times
- (void) sn_pageView:(SNPageView *)pageView itemWillAppear:(SNPageViewItem *)appearItem itemWillDisappear:(SNPageViewItem *)disappearItem;

SNPageView Methods

/// 是否循环滚动(default:NO)
@property (nonatomic, assign)   BOOL          repeatScroll;
/// 当前页数 (default:0)
@property (nonatomic, assign)   NSInteger     currentIndex;

@property (nonatomic, readonly) UIScrollView  *scrollView;

@property (nonatomic, weak) id<SNPageViewDelegate> delegate;
/// 从当前位置滚动到指定的位置
- (void) scrollToPageAtIndex:(NSInteger)index animated:(BOOL)animated;
/// 重新加载
- (void) reloadData;
/// 返回指定索引的 view
- (UIView *)viewAtIndex:(NSInteger )index;

SNPageBar Useage

CGFloat kViewSize = CGSizeMake(320, 640)
CGFloat kPageBarHeight = 40;
CGFloat kPageContentHeight = kViewSize.height - kPageBarHeight;

/// create PageBar
SNPageBar *pageBar = [SNPageBar.alloc initWithFrame:CGRectMake(0, 0, kViewSize.width, kPageBarHeight)];
//pageBar.minItemWidth = 90; // defatul:74 // set item min width
[self.view addSubview:self.pageBar];

/// create item1 and set content view
SNPageBarItem *item1 = [SNPageBarItem.alloc initWithTitle:@"标题1" Target:nil action:nil];
item1.contentView = [SNPageBarContent.alloc initWithFrame:CGRectMake(0, 0, kViewSize.width, kPageContentHeight)];
[pageBar addItem:item1];

/// create item2 and set content view
SNPageBarItem *item2 = [SNPageBarItem.alloc initWithTitle:@"标题2" Target:nil action:nil];
item2.contentView = [SNPageBarContent.alloc initWithFrame:CGRectMake(0, 0, kViewSize.width, kPageContentHeight)];
[pageBar addItem:item2];

/// [pageBar relayout]; //可省略

More

Look for another way of doing this? See Here

License

SNPageView is available under the MIT license. See the LICENSE file for more info.

About

分页控件,轮播(support page view and page view bar)

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors