【发布时间】:2013-05-30 12:44:49
【问题描述】:
大家好,请告诉我如何将此代码操作设置为 UIButton 操作... 这是代码:
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
NSString *myIdentiFier=@"myIdentiFier";
myCell *cell=[tableView dequeueReusableCellWithIdentifier:myIdentiFier];
if(!cell){
//cell=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:myIdentiFier];
NSArray *nib=[[NSBundle mainBundle]loadNibNamed:@"myCell" owner:self options:nil];
for(id obj in nib){
if([obj isKindOfClass:[myCell class]]){
cell=(myCell *)obj;
break;
}
}
}
NSDictionary *diction=(NSDictionary*)[content objectAtIndex:indexPath.row];
[cell.contentView setBackgroundColor:[UIColor orangeColor]];
cell.empID.text=[diction objectForKey:@"empid"];
cell.empName.text=[diction objectForKey:@"empname"];
cell.designation.text=[diction objectForKey:@"empdesignation"];
cell.teamName.text=[diction objectForKey:@"empteam"];
return cell;
}
我想在我的按钮中设置上述操作..
- (IBAction)displayRecord:(id)sender {
}
请告诉我...
【问题讨论】:
-
你在寻找什么
-
@Bhupesh 无论我的 tableview 方法在做什么,我都希望它应该通过按钮操作来完成..
-
您想在表格视图中添加新单元格吗?为此,您需要在数据源中插入新条目,即
content数组。完成后,致电[tableView reloadData]。