我已经创建了自定义 tablview_cell 并在 tableview 的单元格内添加了更多按钮。当我在模拟器中运行时,它工作得很好。但在设备中几乎无法滚动。有什么办法可以解决这个问题,请告诉我。
谢谢提前
我试试这个:
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 250;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return 10;
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString * identifier = @"Cell+Identifier";
Custom_Cell *cell = [tableView dequeueReusableCellWithIdentifier:identifier];
if(cell == nil)
{
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"Custom_Cell" owner:self options:nil];
cell = [nib objectAtIndex:0];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
[cell.btn1 addTarget:self action:@selector(selected_files:) forControlEvents:UIControlEventTouchUpInside];
[cell.btn2 addTarget:self action:@selector(selected_files:) forControlEvents:UIControlEventTouchUpInside];
[cell.btn3 addTarget:self action:@selector(selected_files:) forControlEvents:UIControlEventTouchUpInside];
[cell.btn4 addTarget:self action:@selector(selected_files:) forControlEvents:UIControlEventTouchUpInside];
[cell.btn5 addTarget:self action:@selector(selected_files:) forControlEvents:UIControlEventTouchUpInside];
[cell.btn6 addTarget:self action:@selector(selected_files:) forControlEvents:UIControlEventTouchUpInside];
[cell.btn7 addTarget:self action:@selector(selected_files:) forControlEvents:UIControlEventTouchUpInside];
[cell.btn8 addTarget:self action:@selector(selected_files:) forControlEvents:UIControlEventTouchUpInside];
[cell.btn9 addTarget:self action:@selector(selected_files:) forControlEvents:UIControlEventTouchUpInside];
[cell.btn10 addTarget:self action:@selector(selected_files:) forControlEvents:UIControlEventTouchUpInside];
[cell.btn11 addTarget:self action:@selector(selected_files:) forControlEvents:UIControlEventTouchUpInside];
[cell.btn12 addTarget:self action:@selector(selected_files:) forControlEvents:UIControlEventTouchUpInside];
}
cell.label.text = [NSString stringWithFormat:@"%d",indexPath.row];
return cell;
}
-(void)selected_files:(id)sender
{
View_2 *v2 = [[View_2 alloc]init];
[self.navigationController pushViewController:v2 animated:YES];
}
下面我提到了 Custom_Cell 供您参考。