Latest 0.0.1
Homepage https://github.com/Jason318/GLYPageView
License MIT
Platforms ios 7.0, requires ARC
Authors

最近在做一个项目,需要一个带图标的导航条,在网上找了好多,都没有合适的,于是就自己写了一个,图标可选,可添加可不添加。

带图标的

Image text

不带图标的

Image text

导入:

1.通过Cocoapods安装:

pod ‘GLYPageView’, ‘~> 0.0.1’

2.直接把GLYPageView文件夹拖入项目

使用:

使用很简单,就3个步骤就可实现此功能。

1.初始化

self.pageView = [[GLYPageView alloc] initWithFrame:CGRectMake(0.f, STATUS_BAR_HEIGHT, SCREEN_WIDTH, 44.f) titlesArray:@[@"最新",@"最热的帖子",@"最潮的我",@"这一天天的也真是",@"完美"]];
self.pageView.imagesArray = @[@"NewestSelected",@"Hottest",@"Hottest",@"Hottest",@"Hottest"];
self.pageView.delegate = self;
[self.pageView initalUI];
[self.view addSubview:self.pageView];

是否显示图片、字体大小、图标与字体之间的间距、字体与右边界的距离、字体颜色、字体选择状态下的颜色、小线条的颜色等都可在初始化的时候根据自己的需求自定义。

2.实现外层ScrollView的2个代理方法

实现这个方法是为了记录每次拖动ScrollView的起点self.startOffsetX

#pragma mark -
#pragma mark UIScrollViewDelegate
- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView
{
    self.startOffsetX = scrollView.contentOffset.x;
}

//totalPage外层ScrollView的总页码
- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
    [self.pageView externalScrollView:scrollView totalPage:5 startOffsetX:self.startOffsetX];
}

3.实现GLYPageViewDelegate

- (void)pageViewSelectdIndex:(NSInteger)index
{
    [self.contentScrollView setContentOffset:CGPointMake(index * SCREEN_WIDTH, 0)];
}

Latest podspec

{
    "name": "GLYPageView",
    "version": "0.0.1",
    "summary": "u4e00u4e2au4fbfu6377u6807u7b7eu680f.",
    "description": "GLYPageViewKit",
    "homepage": "https://github.com/Jason318/GLYPageView",
    "license": "MIT",
    "authors": {
        "Jason318": "[email protected]"
    },
    "platforms": {
        "ios": "7.0"
    },
    "source": {
        "git": "https://github.com/Jason318/GLYPageView.git",
        "tag": "0.0.1"
    },
    "source_files": [
        "GLYPageView",
        "GLYPageView/GLYPageView/*.{h,m}"
    ],
    "requires_arc": true
}

Pin It on Pinterest

Share This