项目需要做了一个类似qq联系人的折叠表格,思路很简单:设置每个section的header,在header上显示组名等信息,然后根据折叠与否,设置每个section中cell的数量,如果折叠,则将之设置为0,否则设置为实际的cell数量,然后刷新表格即可. 那么问题来了: 1.如果使用UITableViewStylePlain样式的表格,那么header是会在表格滑动的时候在顶部悬浮,而不是跟随表格的滑动而一起滑动. 2.如果使用了UITableViewStyleGrouped样式的表格,tab…
一,效果图. 二,工程图. 三,代码. RootViewController.h #import <UIKit/UIKit.h> @interface RootViewController : UIViewController <UITableViewDataSource,UITableViewDelegate> { UITableView *mTableView; } @end RootViewController.m #import "RootViewControll…
今天遇到这个问题,即重写的方法 - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section 没有调用. 可能的原因: 1. 没有设置 delegate 2. 没有重写方法 - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section 虽然我的问题不是上述两个,但也…
1.html <div class="custom-fold-table"> <table cellpadding="0" cellspacing="0" width="100%" class="ellipsis-thead custom-table last-column-center table-border"> <thead> <tr> <th w…
UITableView[表格视图] UITableView是表格视图,是UIScrollView的子类,非常重要. 一.表格视图常用属性 1.基本属性方法 创建一个tableView //    UITableViewStylePlain, //扁平风格的 //    UITableViewStyleGrouped //跟系统设置风格是一样的   分组风格 UITableView *tableView = [[UITableView alloc]initWithFrame:self.view.f…
 进来要实现一个tableView 的cell层级显示,网上找的思路都各不相同.下面说一下我的实现思路.  根据根标题存储cell的展开状态,添加到字典中. 话不多说,直接上代码. #define SCREEN_HEIGHT [UIScreen mainScreen].bounds.size.height #define SCREEN_WIDTH [UIScreen mainScreen].bounds.size.width @interface CellTreesController ()<U…
//tableView的创建    //1.初始化 initWithFrame:style:(plian,gronp)    //2.设置属性(行高, 分割线, 表头, 表尾)    //3.添加到父视图    //4.释放        //tableView显示数据    //1.设置dataSource    //2.遵循协议<UITableViewDateSource>    //3.实现两个必须要实现的方法(a. 返回某个分区行数, b.返回cell)        //tableV…
在平常的APP开发过程中经常碰到程序遇到异常闪退的问题,通过日志可以把相关的详细错误信息进行记录,本实例要记录不管在哪个页面出错都要进行记录,这边使用到的日志记录插件CocoaLumberjack,以文本的形式记录错误信息,然后再去读取各个文本的内容进行展示:当然现在有很多第三方的插件比如友盟也已经集成错误记录的功能: 效果图如下: 1:封装DDLogger的类 MyFileLogger.h文件 #import <Foundation/Foundation.h> #import <Coc…
概述 TableView添加右侧索引, 将数据按照索引分组排序, 并添加搜索功能且在搜索界面复用当前页面. 详细 代码下载:http://www.demodashi.com/demo/10696.html 项目中像一些商品搜索类界面, TableView添加右侧索引的使用越来越多, 的确用户体验提高了许多. 一.主要思路 大致思路: 1. 添加并设置右侧索引 2. 自定义汉字转化成拼音文件,通过拼音去匹配首字母 3. 将库存数据按照索引分组排序 4. 添加搜索功能 5. 搜索界面复用库存界面,…
近期公司的项目全然仿了蘑菇街client的框架,自己从网上找了一下,没有发现源代码.问遍各大QQ群也没有结果.上周五晚上一直在思考这个框架怎样搭建,周六早上有了灵感.写了一半.今天接着完好了一下. 在这里和大家分享一下. 我先把效果让大家看一下.然后结合效果说一下自己的实现思路吧. 效果图: 首先呢.最上面的小猫图片,这个将来能够是一张图片或者是一个轮播都能够的,这里临时称作headerView.在ViewController 中设置一个最底端的mainTableView.让mainTableV…
@import url(http://i.cnblogs.com/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css); 自定义UITableViewcell的方法 1.创建cell时,不从重用池找,进来就创建 NSString *identifier = [NSString stringWithFormat:@"cell"]; // 设置cell 标识  UITabl…
- (UIView *) tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { UIView *headerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, tableView.bounds.size.width, 30)]; [headerView setBackgroundColor:[UIColor clearColor]]; r…
一,效果图: 二,工程目录. 三,代码 RootViewController.h #import <UIKit/UIKit.h> @interface RootViewController : UIViewController <UITableViewDataSource,UITableViewDelegate> { UITableView *MyTableView; } @end RootViewController.m #import "RootViewControl…
希望这个从UITableViewDelegate协议里得到的方法可以对你有所帮助: - (UIView *) tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { UIView *headerView = [[[UIView alloc] initWithFrame:CGRectMake(0, 0, tableView.bounds.size.width, 30)] autorelease];…
IOS-tableView中的cellHeadView随着table滚动 设置table的style 首先要将table设置为UITableViewStyleGrouped类型.这样就会得到tableView中的headView随着table的滚动而滚动的现象了. 设置tableSection的高度 然后我们可以通过方法 tableView:heightForFooterInSection: tableView:heightForHeaderInSection: 来控制tableSection中…
- (void)viewDidLoad { [super viewDidLoad]; self.myTableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, 320, 568) style:UITableViewStyleGrouped];分组形式的 self.myTableView.delegate = self; self.myTableView.dataSource = self;     <UITableViewDele…
在.h文件中定义三个数组和一个tablview UITableView *listTable;     NSMutableArray *listArray;     NSMutableArray *proviceArray;     NSMutableArray *statusArray; //定义一个点击方法 -(void)ClickTheSection:(int)section; 在.m文件中使用 //先声明数组和tablview并给数组赋初值 - (void)viewDidLoad {  …
学英语.所以用英文来记录笔记.   Define the dataSource:   @implementation ViewController{    NSMutableArray *dataSourse;     UITableView *myTableView;}   Define the dataSource array:       dataSourse = [NSMutableArray array];    for (int i=0; i<50; ++i) {        NS…
首先我们先集成一个UIView做一个自己的View #import <UIKit/UIKit.h> @interface MyView : UIView @property (nonatomic,strong)UIView * commentView; @end 在实现文件里重写系统的- (UIView*)hitTest:(CGPoint)point withEvent:(UIEvent *)event方法 #import "MyView.h" @implementatio…
原理很简单,一级菜单放在viewForHeaderInSection里面,加一个点击事件,然后判断它的二级菜单(cell)显不显示. 直接上代码吧! // //  HeheTableViewController.m //  Demo-tableView // //  Created by yyt on 16/5/13. //  Copyright © 2016年 yyt. All rights reserved. // #import "HeheTableViewController.h&quo…
// // ViewController.m // UITableView // // Created by City--Online on 15/5/21. // Copyright (c) 2015年 XQB. All rights reserved. // #import "ViewController.h" @interface ViewController ()<UITableViewDataSource,UITableViewDelegate> @propert…
创建 tableView UITableViewStyle 有两种选择 #pragma mark - 创建 tableView - (void)createTableView { // 枚举类型共同拥有两个 self.mainTableView = [[UITableView alloc] initWithFrame:[UIScreen mainScreen].bounds style:UITableViewStylePlain]; [self addSubview:self.mainTable…
// // MainViewController.m // UI10_带分区的省市区 // // Created by dllo on 15/8/11. // Copyright (c) 2015年 zhozhicheng. All rights reserved. // #import "MainViewController.h" #import "SecondViewController.h" @interface MainViewController ()&l…
虽然表格视图可以分组,但是如果分组后,每一行的内容太多,往后翻看起来比较的麻烦.为了解决这个麻烦,可以将分组的行折叠和展开.折叠时,行内容就会隐藏起来:展开时,行内容就会显示出来. 折叠时: 展开后:       具体的代码如下: #import "ViewController.h" @interface ViewController ()<UITableViewDataSource,UITableViewDelegate> @property (weak, nonatom…
原文 :  http://blog.csdn.net/youcanping2008/article/details/9202167 一.实现原理:就是在点击表格组头视图的时候,如果该表格视图的组展开了,就把改组的行设置为0,如果该组隐藏了,就显示该组的所有行. 效果如下: 二.实现步骤 1.定义一个数据模型用于封装数据 #import <Foundation/Foundation.h> @interface MyData : NSObject { NSMutableArray *_array;…
//直接代码 只包含 折叠展开字典的处理搭建#import "CFViewController.h" @interface CFViewController ()<UITableViewDelegate,UITableViewDataSource> { UITableView *CFTableView; //数据 NSArray * CFOnearray; NSMutableArray *CFArray; NSArray *CFDetailArray; CGFloat He…
#import "ViewController.h" #define Ksmall 40.0f #define Klarge 80.0f #define KNoOpen @"NoOpen" @interface ViewController (){ int flag; } @property(nonatomic,retain)NSMutableDictionary *mydata; @end @implementation ViewController - (voi…
UITableView:表格视图控件,继承滚动视图控件UIScrollView,(类似于UIPickerView选择器,它主要通过设置数据源代理和行为代理实现协议来设置单元格)    对表格的操作主要有:创建表格.设置单元格(行数.内容.行高).编辑单元格(删除单元格.插入单元格).移动单元格.标记单元格.修改单元格等.   一.表格式图的属性和行为:   1.基本属性: @interface UITableView : UIScrollView <NSCoding> @property (n…
由于项目上的需求,需要做一个表格出来,来显示流程状态.刚开始脑子一头雾水,没有一点思路,但是靠着自己的座右铭--“世上无难事,只怕有心人”,克服了所有困难.好,不说了,讲正事. 制作表格,还是需要tableView来做. 1. 创建一个UIView对象 : UIView *tableViewHeadView=[[UIView alloc]initWithFrame:CGRectMake(0, 0, kCount*kWidth, kHeight)]; self.myHeadView=tableVi…