java+tableseg,多种功能集成,带Refresh刷新的tableV,Seg分段控件
支持 IOS7+ 详见Demo
TestSegmentAndRefreshTableViewDemo
多种功能集成,带Refresh刷新的tableV,Seg分段控件,加载提示toast
##使用到了
pod 'HMSegmentedControl' ##分段控件
pod 'MJRefresh' ##上下拉刷新
pod 'DZNEmptyDataSet' ##空页面
pod 'SVProgressHUD' ##加载中…
pod 'Toast' ##Toast提示
图片效果
使用 HXTableView
pod 'HXTableView'
- (void)initUI {
CGRect tableVFrame = self.view.frame;
tableVFrame.size.height = tableVFrame.size.height;
tableV = [[HXTableView alloc] initWithFrame:tableVFrame style:UITableViewStylePlain];
// tableV.hiddenExtraLine = YES; //default
//空页面设置
tableV.emptyImage = [UIImage imageNamed:@"icon_refresh_1@2x"];
// tableV.emptyTitle = @"121222";
tableV.emptySubtitle = @"描述";
// tableV.emptyButtontitle = @"按钮啊";
tableV.hxDelegate = self;
[self.view addSubview:tableV];
//空页面点击 刷新
// tableV.emptyAllowTouch = YES;
// [tableV hxTableViewEmptyClick:^{
// NSLog(@"点击了空页面 ,执行刷新");
//
// dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
// dataArr = [NSMutableArray arrayWithArray:@[@"1",@"2"]];
// [tableV reloadData];
// });
//
//
// }];
dataArr = nil;
//刷新 gif 图片
// tableV.refreshGifImageArr = [NSMutableArray arrayWithArray:@[@"icon_refresh_1",@"icon_refresh_2",@"icon_refresh_3"]];
// dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
// tableV.refreshGifImageArr = nil;
// });
tableV.hxCanLoadState = HXCanLoadAll;
}
HX_TABLEVIEW_SepInset(0, 0,tableV)
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return dataArr.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"CustomCell";
//自定义cell类
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
//通过xib的名称加载自定义的cell
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier];
}
cell.textLabel.text = dataArr[indexPath.row];
//选中状态
cell.selectionStyle = UITableViewCellSelectionStyleNone;
//指示类型
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
return cell;
}
#pragma mark hxTableViewDelegate
-(void)loadDataRefreshOrPull:(HXRefreshState)state {
[self requestTest:state];
}
#pragma mark- Request simulate
- (void)requestTest:(HXRefreshState)state {
#warning 正常情况下 都是 一页一页的取数据 如下
NSMutableArray * tmpDataArr = [NSMutableArray arrayWithArray:
@[
@[@"1",@"2"],
@[@"3",@"4"],
@[@"5"]
]
];
#warning 成功的情况下
NSArray * currDataArr = tmpDataArr[tableV.page]; //获取到的分页数据
if (state == HXRefreshing) { //下拉
dataArr = [NSMutableArray arrayWithArray:tmpDataArr[0]];
} else { //上拉
[tableV getCurrentPage]; //page + 1,也可通过获取的page赋值
NSMutableArray * tmpArr = [NSMutableArray array];
if (currDataArr.count >= tableV.pageNum) {
[dataArr addObjectsFromArray:currDataArr];
} else {
[dataArr addObjectsFromArray:currDataArr];
[tableV noMoreData];
}
[dataArr addObjectsFromArray:tmpArr];
}
[tableV endLoading];
使用 分段控件
pod 'HXSegment'
详见代码如seg
//初始化 视图
NSMutableArray * contentVCArr = [NSMutableArray array];
for (int i = 0; i < 3; i ++) {
if (i < 2) {
ExampleTableVC * exampleTableVC = [[ExampleTableVC alloc] init];
exampleTableVC.view.backgroundColor = (i == 0)?[UIColor yellowColor]:[UIColor redColor];
[contentVCArr addObject:exampleTableVC];
} else {
UIViewController * exampleTableVC = [[UIViewController alloc] init];
exampleTableVC.view.backgroundColor = [UIColor greenColor];
[contentVCArr addObject:exampleTableVC];
}
}
HXSegmentVCView * seg = [[HXSegmentVCView alloc] initWithTitleArr:@[@"tableVC1",@"tableVC2",@"VC"] contentVCArr:contentVCArr];
seg.view.frame = CGRectMake(0, 64, HX_SEG_SCREEN_WIDTH, HX_SEG_SCREEN_HEIGHT - 64);
seg.defaultIndex = 1; //设置默认
[self.view addSubview:seg.view];
//改变标题
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[seg setSegTitle:@"1212(1)" index:0];
});
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[seg setSegTitle:@"1111(10)" index:1];
});
//点击事件回调
[seg setSegSelect:^(UIViewController *vc, NSInteger index) {
NSLog(@"seg click %ld",(long)index);
}];
联系我
有什么问题,发邮件到(627556038@qq.com) 或者直接 提问题
java+tableseg,多种功能集成,带Refresh刷新的tableV,Seg分段控件相关推荐
- 用VB实现带图片的XP风格的按钮控件
虽然在VB里实现XP风格很简单,但是要使用XP风格同时又让按钮显示图片,则实现起来要麻烦一些,为此,我写了一个控件来实现前述功能,同时让读者可以从中了解XP主题界面的绘制过程. 使用办法很简单,在VB ...
- python 阻止锁屏_想要自己的手机锁屏更加安全吗?python带你打造个性的锁屏控件...
原标题:想要自己的手机锁屏更加安全吗?python带你打造个性的锁屏控件 Python是一种面向对象.直译式电脑编程语言,也是一种功能强大的通用型语言,已经具有近二十年的发展历史,成熟且稳定.它包含了 ...
- java fxml教程_JavaFX 初学入门(一):FXML嵌套与原始控件继承
说明 之前由于做一个小项目需要用swing,结果swing把我折腾的够呛.后来得知有javaFX这个类似于C#中WPF形式的利用XML来写界面的框架之后,马上就转到javaFX上了.找过一些资料但是帮 ...
- 金格控件java版本_金格全文批注中间件安装软件-金格正文office控件(插件集成)下载V4.3.0.36安装版-西西软件下载...
金格正文office控件(插件集成)是一款中国电信综合办公系统专用金格全文批注中间件插件集成,提供在线新建.编辑office文件和在office文件中进行签名印章.正文套红等功能,安装此控件前请确认您 ...
- Android所有View通用下拉刷新上拉加载控件
转载请声明出处http://blog.csdn.net/zhongkejingwang/article/details/38868463 前面写过一篇关于下拉刷新控件的博客下拉刷新控件终结者:Pull ...
- Android下拉刷新上拉加载控件,对所有View通用!
前面写过一篇关于下拉刷新控件的博客下拉刷新控件终结者:PullToRefreshLayout,后来看到好多人还有上拉加载更多的需求,于是就在前面下拉刷新控件的基础上进行了改进,加了上拉加载的功能.不仅 ...
- 文件的上传下载功能的实现(包括进度条)[telerik控件]
文件的上传下载功能的实现(包括进度条) 1.准备工作 首先我们需要Telerik控件,数据库,上传文件文件夹. Telerik控件: RadUpload.RadProgressManager.RadP ...
- 打造Android万能下拉刷新上拉加载控件
转载请注明出处:http://blog.csdn.net/binbinqq86/article/details/70159782 关于列表刷新加载的自定义控件,网上数不胜数,但别人的用起来始终不是那么 ...
- ThinkPHP5 集成使用 Layui 穿梭框(transfer)控件
背景 最近在做后台业务处理时,接触到了 Layui 中的一个穿梭框 transfer 控件的使用: 个人觉得效果还是挺满意的: 但是毕竟是在 ThinkPHP5 框架下进行的集成,不能不适合部分同行理 ...
最新文章
- 贪心 ---- Educational Codeforces Round 90 (Rated for Div. 2)D Maximum Sum on Even Positions[偶数子段最大和]
- Codeforces 1023A Single Wildcard Pattern Matching
- Sql2000命名中的’_’好象会引发问题
- 类继承、组合和抽象类
- Python之异常处理-Exception
- 图的遍历(Java)构造器
- swig封装 c语言函数到python库,python swig 调用C/C++接口
- excel不显示0_Excel数字过长不能完整显示?超长数字变为0
- web项目从Myeclipse迁移到idea的二三事
- LeetCode 1256. 加密数字(bitset)
- 毕业设计-基于Python爬虫的疫情数据可视化系统
- JavaWeb入门之简单分页查询功能实现
- 在线CSV转Excel工具
- Linux使用cups进行打印
- My97DatePicker组件使用方法
- matlab对信号加噪代码,Matlab给信号加噪声
- okhttp实现连接池原理
- 小程序加载本地图片报错500
- 如果明天要上线,还有很多Bug没有修改,项目经理又没有时间管,你该怎么办?
- 初学者c语言编程软件_C初学者手册:仅需几个小时即可学习C编程语言基础知识