UITableViewCell 撕裂的效果
来源:互联网 发布:phpstudy配置站点域名 编辑:程序博客网 时间:2024/04/26 23:44
总体思路就是: 点击cell时,重新加载tableView,在点击的行返回200的高度,本身cell为50px,
在tableView: cellForRowAtIndexPath:中对相应的行的(contentView中)加入一个高度为150px的UIView,
主要代码如下:
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ if (self.selectIndex != nil && [self.selectIndex compare:indexPath] == NSOrderedSame) { return 200; } else { return 50; }}- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *UserLoginIdentifier = @"RecordManageCell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier: UserLoginIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier: UserLoginIdentifier] autorelease]; } cell.selectionStyle = UITableViewCellSelectionStyleGray; cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;// NSInteger row = [indexPath row]; for (UIView *subView in cell.contentView.subviews) { if (subView.superview != nil) { [subView removeFromSuperview]; } } if (self.oldSelectIndex == self.selectIndex) { } if (self.oldSelectIndex != NULL && self.oldSelectIndex != self.selectIndex) { UITableViewCell *cells = [tableView cellForRowAtIndexPath:self.oldSelectIndex]; for (UIView *subView in cells.contentView.subviews) { NSLog(@"%@",NSStringFromClass([subView class])) ; if (subView.superview != nil) { if ([NSStringFromClass([subView class]) isEqualToString:@"UIView"] ) { [subView removeFromSuperview]; } } } } if (self.selectIndex != NULL && [self.selectIndex row] == [indexPath row]) { UIView *subView = [[[UIView alloc] initWithFrame:CGRectMake(0, 50, 300, 150)] autorelease]; subView.backgroundColor = [UIColor blackColor]; [cell.contentView addSubview:subView]; } CGSize size = cell.contentView.frame.size; UILabel *lable = [[[UILabel alloc] initWithFrame:CGRectMake(10, 5, size.width, 35)] autorelease]; [cell.contentView addSubview:lable]; lable.backgroundColor = [UIColor clearColor]; lable.text = @"新民色fsf额s法"; return cell;}#pragma mark -#pragma mark Table Delegate Methods - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ //[tableView deselectRowAtIndexPath:indexPath animated:YES]; // [self playRecordFile:[indexPath row]]; self.oldSelectIndex = self.selectIndex; self.selectIndex = indexPath; NSArray *array = [NSArray arrayWithObject:indexPath]; [tableView reloadRowsAtIndexPaths:array withRowAnimation:UITableViewRowAnimationFade];}
效果如下:
- UITableViewCell 撕裂的效果
- 如何制作一个纸张的撕裂效果
- 可撕裂布料效果 赞
- 撕裂我的头发
- 实现折叠的uitableviewcell效果
- CoreAnimation——类似艺龙客户端首页的撕裂+后台推送效果
- 被撕裂的中国三
- 被撕裂的中国二
- 被撕裂的中国一
- UITableViewCell的点击效果,不可点击
- UITableViewCell加载时的简单动画效果
- Swift实现UITableViewCell的翻转效果
- 撕裂牛仔的实穿八大法则
- 如何撕裂你的DVD免费 (2)
- 关闭UITableViewCell选中效果
- UITableViewCell去掉点击效果
- UITableViewCell编辑效果
- 定制UITableviewCell实现类似微博的分组效果
- java 实现单链表的反转
- ExtJS4.1自带API打不开的问题解决
- Perl 获取shell命令的执行结果
- JAVA变量类型之间的相互转换
- AS3学习路线
- UITableViewCell 撕裂的效果
- 认识 XHTML
- 再次改程序BUG
- Ext.UpdateManager实现页面任意部分自动刷新
- Java关键字final、static使用总结1
- jsp常用内置对象的常用方法(待续)
- ubuntu 桌面环境下显示文件全路径
- Java关键字final、static使用总结2
- MFC动态显示图片的方法