- 浏览: 2477708 次
- 性别:
- 来自: 苏州
文章分类
最新评论
-
jsntghf:
peio 写道这个怎么运行?Ruby On Rails的环境搭 ...
多文件上传之uploadify -
peio:
这个怎么运行?
多文件上传之uploadify -
往事如烟1:
我的项目是自己init了一个原始的project,之后将ver ...
React Native热部署之CodePush -
jsntghf:
往事如烟1 写道我按照你的说明进行,发现app退出之后,在进入 ...
React Native热部署之CodePush -
往事如烟1:
我按照你的说明进行,发现app退出之后,在进入不正确,请问是什 ...
React Native热部署之CodePush
以前,写了一篇文章:可伸缩的表视图,实现的是类似QQ的可折叠形式的表视图,这篇文章提供了另一种解决方案。
下面只列出表视图的相关代码,其他代码请参考附件。
RootNavigationController.h
#import <UIKit/UIKit.h> @interface RootNavigationController : UINavigationController { } @end #import "QQSectionHeaderView.h" @interface RootViewController : UITableViewController<QQSectionHeaderViewDelegate> { NSMutableArray *lists; } @end
RootNavigationController.m
#import "RootNavigationController.h" #import "QQList.h" @implementation RootNavigationController @end #define HEADER_HEIGHT 35 @implementation RootViewController - (void) loadQQData { for (int i = 0; i < 10; i++) { QQList *list = [[[QQList alloc] init] autorelease]; list.m_nID = i; list.m_strName = @"QQGroupName"; list.m_arrayPersons = [[[NSMutableArray alloc] init] autorelease]; list.opened = YES; for (int j = 0; j < arc4random() % 20; j++) { QQPerson *person = [[[QQPerson alloc] init] autorelease]; person.m_nQQNumber = 10000 + abs(arc4random() % 100000000); person.m_nListID = i; person.m_bIsOnline = arc4random() % 10 < 5 ? YES : NO; person.m_strNickName = @"[Eric]"; person.m_strRemarkName = arc4random() % 10 < 5 ? @"张三": @"李四"; person.m_strLongNickInfo = @"http://2015.iteye.com"; person.m_strHeadImageURLString = nil; [list.m_arrayPersons addObject:person]; } [lists addObject:list]; } } - (void)loadView { [super loadView]; lists = [[[NSMutableArray alloc] init] retain]; [self performSelector:@selector(loadQQData)]; } - (void)viewDidLoad { [super viewDidLoad]; [self setTitle:@"QQTableView"]; self.tableView.delegate = self; self.tableView.dataSource = self; } - (void)dealloc { [lists release]; [super dealloc]; } #pragma mark - #pragma mark Table view data source - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{ return HEADER_HEIGHT; } - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return [lists count]; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { QQList *persons = [lists objectAtIndex:section]; if ([persons opened]) { return [persons.m_arrayPersons count]; } else { return 0; } } - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { QQList *persons = [lists objectAtIndex:section]; int onlineCount = 0; for (QQPerson *person in persons.m_arrayPersons) { if ([person isOnline]) { onlineCount++; } } NSString *headString = [NSString stringWithFormat:@"%@ [%d/%d] ", persons.m_strName, onlineCount, [persons.m_arrayPersons count]]; QQSectionHeaderView *sectionHeadView = [[QQSectionHeaderView alloc] initWithFrame:CGRectMake(0.0, 0.0, self.tableView.bounds.size.width, HEADER_HEIGHT) title:headString section:section opened:persons.opened delegate:self]; return [sectionHeadView autorelease]; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease]; } QQList *persons = [lists objectAtIndex:indexPath.section]; QQPerson *person = [persons.m_arrayPersons objectAtIndex:indexPath.row]; if ([person isOnline]) { [cell textLabel].text = person.m_strNickName; } else { [cell textLabel].text =[NSString stringWithFormat:@"%@ (Offline)", person.m_strNickName]; } [cell textLabel].font = [UIFont boldSystemFontOfSize:14.0]; [cell detailTextLabel].text = person.m_strLongNickInfo; [cell setImage:[UIImage imageNamed:@"headicon.jpg"]]; return cell; } - (void)sectionHeaderView:(QQSectionHeaderView *)sectionHeaderView sectionClosed:(NSInteger)section { QQList *persons = [lists objectAtIndex:section]; persons.opened = !persons.opened; NSInteger countOfRowsToDelete = [self.tableView numberOfRowsInSection:section]; if (countOfRowsToDelete > 0) { persons.indexPaths = [[NSMutableArray alloc] init]; for (NSInteger i = 0; i < countOfRowsToDelete; i++) { [persons.indexPaths addObject:[NSIndexPath indexPathForRow:i inSection:section]]; } [self.tableView deleteRowsAtIndexPaths:persons.indexPaths withRowAnimation:UITableViewRowAnimationTop]; } } - (void)sectionHeaderView:(QQSectionHeaderView *)sectionHeaderView sectionOpened:(NSInteger)section { QQList *persons = [lists objectAtIndex:section]; persons.opened = !persons.opened; if(persons.indexPaths) { [self.tableView insertRowsAtIndexPaths:persons.indexPaths withRowAnimation:UITableViewRowAnimationBottom]; } persons.indexPaths = nil; } @end
示例图:
- TQQTableView.zip (45.2 KB)
- 下载次数: 72
发表评论
-
Error watching file for changes: EMFILE
2016-12-15 11:57 1239执行npm start后报错: Error watc ... -
CocoaPods升级1.1.1报错
2016-12-15 08:39 743ERROR: While executing gem .. ... -
Visual Studio Code运行React Native报错
2016-06-13 09:43 1561React Native:0.27.2 React:15 ... -
React Native 0.27.2编译报错this._nativeModule.addListener is not a function
2016-06-12 15:21 3793React Native:0.27.2 React:15 ... -
Unable to resolve module ReactDefaultPerf from
2016-06-02 13:04 2736package.json信息如下: "reac ... -
React Native 0.26.2编译报错Undefined symbols for architecture x86_64
2016-05-26 11:15 1950React Native:0.26.2 React:15. ... -
Failed to update auto layout status: Failed to load designables from path (null)
2016-04-05 22:11 1669确保CocoaPods是0.36.1以上版本,然后在podf ... -
集成微信支付出现Undefined symbols for architecture x86_64错误
2016-03-21 13:22 1684Undefined symbols for architec ... -
React Native热部署之CodePush
2016-01-10 22:27 6134本文使用的环境是Mac OS 10.11.1、Xcode ... -
浅谈React Native中的FlexBox布局
2015-11-17 18:38 4272React Native通过一个基于FlexBox的布局引 ... -
React Native之构建一个简单的列表页
2015-10-23 14:45 2100本文中我们将创建一个简单的电影应用,这个应用将从Rotten ... -
React Native之环境搭建
2015-10-20 16:30 1395本文使用的环境是Mac O ... -
获取图片属性的方法
2015-10-18 20:43 3083很多时候我们需要获 ... -
NSCache的下标用法
2015-09-18 00:19 1171NSCache类和NSDictionary类很相似,也提供 ... -
如何给category添加属性
2015-08-16 10:41 645主要是使用了runtime中的associative机制。 ... -
UITableView的两种重用Cell方法的区别
2015-08-10 13:07 16069UITableView中有两种重用Cell的方法: - ... -
SDImageCache.m报错Unused variable 'fileName'
2015-08-04 21:56 1134GCC手册中的相关解释: unused:This att ... -
Swift调用Objective-C
2015-07-13 23:33 1178Swift调用Objective-C需要一个名为<工程 ... -
使用GCD实现倒计时
2015-07-24 21:47 1046__block int timeout = 60; // ... -
导航栏加分割线的实现
2015-07-01 22:00 1694self.view.backgroundColor = [U ...
相关推荐
可伸缩标题视图+水平可滑动选项卡视图 用法 运行示例项目; 克隆存储库,然后首先从Example目录运行pod install 。 屏幕截图 可伸缩页眉 可滑动的标签 安装 AXStretchableHeaderTabViewController可通过。 要安装它...
iOS展示视图移动的简单动画效果,点击目标视图自动伸缩
DKStickyHeaderView SticklyHeaderView可以粘在顶部并在您拉下时伸展。 如何使用 let headerView = DKStickyHeaderView ( minHeight : 0 ) headerView. backgroundColor = UIColor....self . tableView ....
1、为用户设计:满足功能需求及质量需求(易用性、性能、可伸缩性、持续可用性)。 2、为客户设计:充分考虑客户的业务目标、上线要求的时间、预算限制以及集成需要等,还有特别关注客户所在领域的业务规则和业务...
软件架构概念:将若干结构元素进行装配,从而满足系统主要功能和性能需求,并满足其他非功能性需求,如可靠性、可伸缩性、可移植性和可用性。用来处理软件高层次结构的设计和实施。
使用稀疏隔行扫描视图图像集和视差的3D全息图像的可伸缩编码
可折叠伸缩的多级(至少三级)内容列表(类似于Unity的Hierarchy视图中的折叠效果)
SpringTableHeader 是一个非常基础的 UIScrollView 的头部弹性视图
简介此示例项目展示了如何在iOS中将Expandable / Collapsable TableView实现为滑动菜单。... TableView在选择一行时会... 想要自定义它的任何人都可以通过更改表格视图中的颜色或配件来非常容易地做到这一点。 屏幕截图
## Diver:用于逆向工程的动态交互式视图 ###潜水员已经退休。 感谢您对我们的研究项目的支持! Diver是用于调试和逆向工程的一组高级工具。 如果您想知道“我的程序只是做什么?”,Diver会帮助您找到答案。 Diver...
恒生国际这是本文的一个非常简单的实现: 高度经济的多视图二进制压缩,用于可伸缩图像聚类, 可以在ECCV 2018论文(即将发布)中找到详细信息。 该代码已在Matlab 2017a上进行了评估。 资源: 我们提供ImageNet-10...
Rookey.Frame是一套基于.NET的极速开发框架,支持简单逻辑模块零代码编程、支持二次开发,具有高扩展性、高复用性、高伸缩性、高性能 2.框架特点: (1)简单逻辑模块实现零代码编程,通过简单配置即可实现增、删、...
Oracle是当今各领域中应用比较广泛的一个大型关系型数据库产品,它以其所拥有的稳定、可伸缩性强以及安全可靠等特性受到越来越多的系统开发人员的青睐,正成为企业开发信息系统的首选产品。同其他数据库管理系统相比...
flex 可伸缩 大于0的时候才可伸缩 "position", relative/absolute 样式的: "resizeMode", 图片缩放 cover 保持图片宽高比的前提下缩放图片,直到宽度和高度都大于等于容器视图的尺寸 contain 保持图片宽高比...
10.1.1 性能、吞吐量和可伸缩性 13 10.1.2 可用性和可靠性 13 10.1.3 安全性 13 10.1.4 可管理性 13 10.1.5 易用性 13 10.1.6 可维护性 13 10.1.7 扩展性和灵活性 13 10.1.8 可重用性 13 11. 容灾设计 14 11.1 容灾...
与复制移动伸缩等等功能,可以保存绘制的图形, 缩放和平移视图。 支持图层。 图元支持夹点,并且可以通过移动夹点来修改图元。 捕捉。目前支持的捕捉类型有:端点、中点、中心点、象限点。 基本的编辑操作:...
响应式网格视图通常是 12 列,宽度为100%,在浏览器窗口大小调整时会自动伸缩。 以上实例包含两列。 12 列的网格系统可以更好的控制响应式网页。 首先我们可以计算每列的百分比: 100% / 12 列 = 8.33%。 在每列中...
视图布局(View Layout)之模仿ness伸缩效果 视图布局-Animated Grid 视图布局-Note ViewController 视图布局-Side bar demo 视图布局-Sliding Grid View 视图布局类》》Circle Layout 视图布局类-HGPhoto Wall ...
这是一个FlexibleScrollerView动态滚动视图案例,源码FlexibleScrollerViewSample,模仿最美应用动态滚动视图,图片可伸缩,按钮固定到导航栏。 测试环境:Xcode 6.2,iOS 6.0以上