iOS UITableView3
来源:互联网 发布:2015年酒店行业数据 编辑:程序博客网 时间:2024/06/16 11:32
1下拉刷新
//=================下拉刷新
(void)downRefresh{
UIRefreshControl *refresh = [[UIRefreshControl alloc]init];
[tableView addSubview:refresh];
refresh.tintColor = [UIColor cyanColor];
refresh.tag = 1000;
refresh.attributedTitle = [[NSAttributedString alloc]initWithString:@”下拉刷新” attributes:@{NSForegroundColorAttributeName:[UIColor cyanColor]}];
[refresh addTarget:self action:@selector(refreshAct:) forControlEvents:UIControlEventValueChanged];
}(void)refreshAct:(UIRefreshControl*)refresh{
[refresh beginRefreshing]; //开始刷新
refresh.attributedTitle = [[NSAttributedString alloc]initWithString:@”正在刷新” attributes:@{NSForegroundColorAttributeName:[UIColor cyanColor]}];
[self performSelector:@selector(refreshFinish) withObject:nil afterDelay:5];
}(void)refreshFinish{
UIRefreshControl refresh = (UIRefreshControl )[tableView viewWithTag:1000];
refresh.attributedTitle = [[NSAttributedString alloc]initWithString:@”刷新失败” attributes:@{NSForegroundColorAttributeName:[UIColor cyanColor]}];
[refresh endRefreshing];//结束刷新
}
2选中单元格的处理
显示不一样的背景 字体
//=========选中cell 背景颜色变化 文字大小 颜色变化
- (void)tableView:(UITableView )tableView didSelectRowAtIndexPath:(NSIndexPath )indexPath{
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];UIView *view = [[UIView alloc]initWithFrame:cell.bounds];view.backgroundColor = [UIColor redColor];cell.selectedBackgroundView = view;//新建一个label 得到原来label的text 但他遮不住 cell选中view 的文字 但可以将其设为通明 这样就看不出来了UILabel *label = [[UILabel alloc]initWithFrame:cell.textLabel.bounds];label.text = cell.textLabel.text;label.textColor = [UIColor whiteColor];label.font = [UIFont systemFontOfSize:24];label.backgroundColor = [UIColor redColor];[cell.selectedBackgroundView addSubview:label];cell.textLabel.highlightedTextColor = [UIColor clearColor];
}
//=========选中cell 背景颜色变化 颜色变化 文字大小不能改变
(void)tableView:(UITableView )tableView didSelectRowAtIndexPath:(NSIndexPath )indexPath{
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
UIView *view = [[UIView alloc]initWithFrame:cell.bounds];
view.backgroundColor = [UIColor redColor];
cell.selectedBackgroundView = view;
cell.textLabel.highlightedTextColor = [UIColor whiteColor];
}
- iOS UITableView3
- 2015年7月11日UITableView3
- iOS
- iOS
- IOS
- iOS
- iOS
- IOS
- ios
- iOS
- iOS
- IOS
- iOS
- ios
- ios ~~~~~
- ios
- IOS
- IOS
- 一对多、对多一、批量操作
- poj 2985(并查集+线段树求K大数)
- 第五周项目3(2)
- 仿QQ侧滑边栏
- 第5周-项目4-长方柱类
- iOS UITableView3
- 双向循环链表代码实践
- 百度切片工具新功能:添加麻点,点击弹出图文组合信息窗口
- Android案例二,打招呼
- yum软件安装目录解释
- linux环境下Matlab中socket网络功能的实现
- nyoj82 迷宫寻宝(一)(DFS 推荐看看)
- Linux(Puppy lina)中打开GB2312编码的文本文件乱码的解决
- 小鑫杀怪兽