标签:
#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.accessoryType = UITableViewCellAccessoryDisclosureIndicator; cell = [[[NSBundle mainBundle] loadNibNamed:CellIdentifier owner:self options:nil] lastObject]; return cell; } - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { [tableView deselectRowAtIndexPath:indexPath animated:YES]; } #pragma mark ---- TableView结束
/////分页 - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath { if(indexPath.row==(m_tieziDetailList.count-1)&&isEndList==NO) { iListCountNum++; NSLog(@"%d",indexPath.row); NSThread *InitThread = [[NSThread alloc]initWithTarget:self selector:@selector(GetNewListThread:) object:tableView]; [InitThread start]; } } -(void)GetNewListThread:(id)sender { NSMutableArray *array = [g_json GetJIKETieZiHFListFromServerWithtopicId:topic_idNode.topic_id m_pageSize:20 m_pageNum:iListCountNum]; if(array.count == 0) { isEndList = YES; } else { isEndList=NO; } [m_tieziDetailList addObjectsFromArray:array]; [self performSelectorOnMainThread:@selector(ReLoadTableData:) withObject:(UITableView*)sender waitUntilDone:NO]; } -(void)ReLoadTableData:(id)sender { UITableView *table = (UITableView*)sender; [table reloadData]; }
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell = [self tableView:tableView cellForRowAtIndexPath:indexPath]; return cell.frame.size.height; }
NSArray* nibView = [[NSBundle mainBundle] loadNibNamed:@"ManagerTileCell" owner:nil options:nil]; UITableViewCell *cell = [nibView objectAtIndex:0]; cell.selectionStyle = UITableViewCellSelectionStyleNone;
设置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]; } }
标签:
原文地址:http://www.cnblogs.com/zzzili/p/4903403.html