Latest 1.1.0
Homepage https://github.com/sheodon/SNPageView
License MIT
Platforms ios 5.0, requires ARC
Frameworks Foundation, UIKit
Authors

GitHub license
Version
Platform
GitHub stars

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

ScreenShots

SNPageView

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.

Latest podspec

{
    "name": "SNPageView",
    "version": "1.1.0",
    "summary": "u5206u9875u6edau52a8u63a7u4ef6uff0cu53efu5b9eu73b0u8f6eu64aduff08support page view and tab page viewuff09",
    "description": "u5206u9875u6edau52a8u63a7u4ef6uff0cu53efu5b9eu73b0u8f6eu64aduff08support page view and tab page viewuff09by Objective-C",
    "homepage": "https://github.com/sheodon/SNPageView",
    "license": "MIT",
    "authors": {
        "sheodon": "[email protected]"
    },
    "platforms": {
        "ios": "5.0"
    },
    "source": {
        "git": "https://github.com/sheodon/SNPageView.git",
        "tag": "1.1.0"
    },
    "source_files": [
        "SNPageView",
        "SNPageView/**/*.{h,m}"
    ],
    "frameworks": [
        "Foundation",
        "UIKit"
    ],
    "requires_arc": true
}

Pin It on Pinterest

Share This