Skip to content
YBookmarkView 是类似新闻的书签页面形式,大部分项目都需要用到,现在贡献出来,方便大家使用方便
Objective-C Ruby
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Example
YBookmarkView
.gitignore
.travis.yml
LICENSE
README.md
YBookmarkView.podspec
_Pods.xcodeproj

README.md

YBookmarkView

CI Status Version License Platform

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Installation

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

pod 'YBookmarkView'

Usage

1、创建初始化BookmarkView

- (YBookmarkView *)bookmarkView
{
    if (!_bookmarkView) {
        _bookmarkView = [[YBookmarkView alloc] initWithFrame:self.view.frame];
        _bookmarkView.dataSource = self;
        _bookmarkView.delegate = self;
        [_bookmarkView configMake:^(YBBookMarkConfig *config) {
            config.topViewHeight = 50;
            config.titleSelectFont = [UIFont systemFontOfSize:17];
//          	config.fixedTitleWidth = 100; //如果标题是固定宽度设置
//					还有很多参数可以设置,自己体会吧 😊
        }];
    }
    return _bookmarkView;
}

2、实现几个DataSource方法

/**
 bookMarkView 数据来源

 @param bookMarkView bookMarkView
 @return 控制器数量
 */
- (NSInteger)numberOfItemInBookMarkView:(YBookmarkView *)bookMarkView;

/**
 top title 标签

 @param bookMarkView bookMarkView
 @param index 第几个标签
 @return title
 */
- (NSString *)bookMarkView:(YBookmarkView *)bookMarkView titleAtIndex:(NSInteger)index;

/**
 控制器  数据来源
 说明:每个控制器不会重复调用
 @param bookMarkView bookMarkView
 @param index 第几个标签
 @param viewRect 控制器的CGRect 大小
 @return 控制器
 */
- (UIViewController *)bookMarkView:(YBookmarkView *)bookMarkView viewAtIndex:(NSInteger)index viewRect:(CGRect)viewRect;

3、装载数据

[self.bookmarkView reloadData];

4、YBookMarkViewDelegate 回调

//** 点击 title 回调 */
- (void)bookMarkView:(YBookmarkView *)bookMarkView didSelectTitleAtIndex:(NSInteger)index;
//** 滚动到第几个标签回调 */
- (void)bookMarkView:(YBookmarkView *)bookMarkView didScrollToIndex:(NSInteger)index;
//** bottomMark 滑动结束 回调*/
- (void)bookMarkView:(YBookmarkView *)bookMarkView didEndDecelerating:(NSInteger)index;
- (void)bookMarkView:(YBookmarkView *)bookMarkView updateLayoutIndex:(NSInteger)index viewController:(UIViewController *)vc;
//** bottomMark 将要显示 回调*/
- (void)bookMarkView:(YBookmarkView *)bookMarkView bottomMarkWillDisplayCell:(UICollectionViewCell *)cell atIndex:(NSInteger)index;
//** 第index个子控制器 将要显示 回调*/
- (void)bookMarkView:(YBookmarkView *)bookMarkView willDisplayingVC:(__kindof UIViewController *)vc index:(NSInteger)index;
//** 第index个子控制 结束显示 回调*/
- (void)bookMarkView:(YBookmarkView *)bookMarkView didEndDisplayingVC:(__kindof UIViewController *)vc index:(NSInteger)index;

Author

Ethanbing, 380711712@qq.com

License

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

You can’t perform that action at this time.