UITableView动态加载cell,仿百度贴吧效果
来源:互联网 发布:哪里找淘宝单刷 编辑:程序博客网 时间:2024/05/08 07:50
今天开通了自己的第一的csdn博客,写第一篇文章吧。
我是个iOS菜鸟,今天刚刚考试完,心情大好,前阵子玩百度贴吧的iPhone客户端,发现它里面的列表加载效果挺好的,于是自己做了一个,效果可能不是特别像吧,不知道思路对不对。
这里是核心代码实现,大家应该都知道iOS里面单元格的复用机制,不知道的可以去查一下资料。实现的思路就是在代理方法中先把cell的透明度和frame进行修改,然后再利用UIView的动画复原,就有了动态加载的效果;
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath;{ static NSString *identify = @"cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identify]; if (cell == nil) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identify]; [cell setBackgroundColor:[UIColor purpleColor]]; } //cell.frame.size.height *=10; CGRect frame = cell.frame; CGRect or_frame = frame; frame.size.height += 80; frame.origin.y += 1000; [cell setFrame:frame]; [cell setAlpha:0.1]; [cell.textLabel setText:identify]; [UIView animateWithDuration:1 animations:^{ [cell setAlpha:1.0f]; [cell setFrame:or_frame]; }]; return cell;}
工程文件下载地址:http://pan.baidu.com/s/1kThY0j9
如果大家有什么更好的思路欢迎大家提出来,共同进步。
0 0
- UITableView动态加载cell,仿百度贴吧效果
- iOS8 UITableView动态加载cell的高度
- UITableView /cell上的button,动态配置tableView的cell的高度(效果为点击加载更多,cell加载所有内容,反之,只加载3行)
- 纯CSS3实现动态翻牌效果 仿百度贴吧3D翻牌一次动画特效
- CSS3实现动态翻牌效果 仿百度贴吧3D翻牌一次动画特效
- ios tableView那些事 (十九) UITableView 加载动态cell
- UITableView cell 被选中效果
- uitableview自定义cell,cell加载图片
- uitableview cell上加载webview
- UITableView cell 的动态使用
- UITableView动态改变Cell高度
- UITableView动态改变Cell高度
- asp.net 仿百度动态加载下拉菜单
- Pony,仿支付宝到位动态加载marker效果
- 仿百度动态查询
- 关闭UITableView cell的被选中效果
- UITableView的cell 动态 定义 高度
- UITableView的cell 动态 定义 高度
- 项目--杂记
- 第四章 驱动开发_vivi、uboot、eboot的区别
- 第五章 驱动开发_Nand flash启动 & Nor flash启动 & 时钟倍频
- 第六章 驱动开发_JTAG接口和supervivi
- 再论句子中单词的逆序输出
- UITableView动态加载cell,仿百度贴吧效果
- Quake III Arena 源代码在 Win32 下的编译
- Image的生成过程
- [Android实例] 销毁activity时注意关闭线程
- 编程习惯(一)头文件与cpp文件为什么要分开写
- struts2从action值传道到jsp中
- 写给我的2013
- 创建触发器时出现 PLS-00049: 错误的赋值变量 ':NEW.modify_man'
- Mathematics for 3D Game Programming and Computer Graphics - Lines in 3D Space