ZWSlideViewController 0.1.5

ZWSlideViewController 0.1.5

测试已测试
语言语言 Obj-CObjective C
许可协议 MIT
发布上次发布2017年5月

Square维护。



  • square

ZWSlideViewController 是一个视图控制器容器,用于管理可定制的滑动视图和菜单。

屏幕截图

Screenshot

用法

要显示滑动页面,请使用以下代码

步骤 1

创建一个继承自 ZWSViewController 的类

@interface ZWViewController : ZWSViewController

@end

步骤 2

实现所需方法

- (void)loadData
{
    self.menuTitles = @[@"Drama", @"Family", @"Fantasy", @"Thriller", @"Horror", @"Comedy"];
}

- (UIView *)contentViewForPage:(ZWSPage *)page atIndex:(NSInteger)index
{
    UITableView *tableView = [[UITableView alloc] initWithFrame:page.bounds];

    [tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"kCellIdentifier"];
    tableView.dataSource = self;
    
    tableView.backgroundColor = [UIColor colorWithRed:0.5 green:0.1*index blue:0.2*index alpha:1];
    
    return tableView;
}

或放置任何您想要的视图

- (UIView *)contentViewForPage:(ZWSPage *)page atIndex:(NSInteger)index
{
    UIView *view = [[UIView alloc] init];
    
    view.backgroundColor = [UIColor colorWithRed:0.5 green:0.1*index blue:0.2*index alpha:1];
    
    return view;
}

如果您有异步加载请求数据以刷新滑动页面,请请求完成后调用以下代码

[self refreshViews];

您也可以在这里放置一些调整过样式的代码

    self.sectionBar.selectedTextColor = [UIColor blueColor];
    self.sectionBar.nomarlTextColor = [UIColor redColor];
    self.sectionBar.backgroundColor = [UIColor blackColor];
    self.menuHeight = 64.0f;

查看示例项目以了解如何使用更多自定义的内容

作者

@squarezw , @lamo

许可协议

ZWSlideViewController 可在 MIT 许可协议下使用。有关更多信息,请参阅 LICENSE 文件。