ZWSlideViewController
是一个视图控制器容器,用于管理可定制的滑动视图和菜单。
要显示滑动页面,请使用以下代码
创建一个继承自 ZWSViewController 的类
@interface ZWViewController : ZWSViewController
@end
实现所需方法
- (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;
查看示例项目以了解如何使用更多自定义的内容
ZWSlideViewController 可在 MIT 许可协议下使用。有关更多信息,请参阅 LICENSE 文件。