TableView
来源:互联网 发布:济南易途java培训 编辑:程序博客网 时间:2024/05/14 15:20
#pragma mark ---- TableView开始//////////////////////////////////////////// Customize the number of sections in the table view.- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 1;}// Customize the number of rows in the table view.- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return [JDList count];}- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ return 88;}// Customize the appearance of table view cells.- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"ListCell"; ListCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[ListCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; } cell = [[[NSBundle mainBundle] loadNibNamed:CellIdentifier owner:self options:nil] lastObject]; cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; return cell; }- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ [tableView deselectRowAtIndexPath:indexPath animated:YES];}#pragma mark ---- TableView结束
不等高
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ UITableViewCell *cell = [self tableView:tableView cellForRowAtIndexPath:indexPath]; return cell.frame.size.height;}
直接cell.xib
NSArray* nibView = [[NSBundle mainBundle] loadNibNamed:@"ManagerTileCell" owner:nil options:nil]; UITableViewCell *cell = [nibView objectAtIndex:0]; cell.selectionStyle = UITableViewCellSelectionStyleNone;
self.tableView.tableHeaderView = [[UIViewalloc]initWithFrame:CGRectMake(0,0, 0,CGFLOAT_MIN)];
设置Cell不可点击
self.m_table.allowsSelection =NO;
设置Cell点击后不变色
cell.selectionStyle =UITableViewCellSelectionStyleNone;
////////滑动删除//先要设Cell可编辑- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath{ if(indexPath.section==0) return NO; else return YES;}//定义编辑样式- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath{ return UITableViewCellEditingStyleDelete;}//进入编辑模式,按下出现的编辑按钮后- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath{ id obj = [self.dataList objectAtIndex:indexPath.row]; if([obj isKindOfClass:[NearChatNode class]]) { NearChatNode *nearmsg = obj; NSString *sql = [NSString stringWithFormat:@"delete from chatHis where msgFromUid='%@' or msgToUid='%@';DELETE from chatNearHis where myid='%@' or other='%@';",nearmsg.vo_id,nearmsg.vo_id,nearmsg.vo_id,nearmsg.vo_id]; [g_data.sqlite NSSendSql:sql]; [self notiRefreshMyMsg]; }}
- TableView
- TableView
- tableview
- tableview
- tableview
- TableView
- TABLEVIEW
- tableView
- tableView
- TableView
- tableview
- tableview
- tableView
- tableView
- tableView
- tableView
- TableView
- tableview
- 《C++面向对象》结构体继承
- iphone 开发之过滤html标签
- magento 消息机制
- LeetCode : Restore IP Addresses
- minus
- TableView
- DbMon.c (zz)
- 优化型网站的注意事项
- Oracle忘记system密码或system密码过期后怎么还原
- 我所了解的网盘
- UITabBarController
- magento 消息机制和错误信息传递
- exit、return、_exit、_Exit这几个函数的区别
- 言语上以礼待人