GFPageSlider 1.2.2

GFPageSlider 1.2.2

测试已测试
语言语言 Obj-CObjective C
许可证 MIT
发布上次发布2016年11月

Mercy 维护。



  • 作者:
  • Mercy

它是一个简单的页面滑块模块,易于使用且耦合度低。

它可以灵活自定义菜单栏的高度、菜单栏中显示的菜单数量以及指示器的颜色。

屏幕截图

安装

GFPageSlider 可在 CocoaPods 上使用。只需将以下内容添加到项目 Podfile:

pod 'GFPageSlider'

使用方法

1、导入头文件【导入头文件】

#import "GFPageSlider.h"

2、初始化各个页面的控制器,并将它们添加为当前控制器的子控制器【初始化各个页面的控制器,并将它们添加为当前控制器的子控制器】

[self initViewControllers];

[self addChildViewController:_viewControllers[0]];
[self addChildViewController:_viewControllers[1]];
[self addChildViewController:_viewControllers[2]];
[self addChildViewController:_viewControllers[3]];

2、初始化 PageSlider 并输入参数:其框架、页数、视图控制器和菜单按钮的标题【初始化 PageSlider】

GFPageSlider *pageSlider = [[GFPageSlider alloc] initWithFrame:CGRectMake(0, 0, kSelfViewWidth, kSelfViewHeight - 64)
                                                  numberOfPage:4
                                               viewControllers:_viewControllers
                                              menuButtonTitles:@[@"头条", @"娱乐", @"热点", @"体育"]];

3、将 PageSlider 添加为当前视图的子视图【将 PageSlider 添加为当前视图的子视图】

[self.view addSubview:pageSlider];

4、设置 PageSlider 的属性(可选,如果未设置,则使用默认值)【配置属性】

pageSlider.menuHeight = 40.0f;
pageSlider.menuNumberPerPage = 5;
pageSlider.indicatorLineColor = [UIColor blueColor];

5、如果您想添加更多页面,只需准备您的页面控制器,然后调用此方法【使用下面的方法可以动态添加页面】

[pageSlider addPagesWithPageCount:3
                  viewControllers:_viewControllers
                 menuButtonTitles:@[@"汽车", @"科技", @"财经"]];

许可证

GFPageSlider 是在 MIT 许可证下发布的

Copyright (c) 2015-2016 Gu Gaofei (@gydmercy)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.