gpt4 book ai didi

ios - didDeselectRowAtIndexPath 没有在 UITableView 的第一行被调用

转载 作者:可可西里 更新时间:2023-11-01 04:05:17 24 4
gpt4 key购买 nike

<分区>

我的 UITableView 出现了一个奇怪的问题。每当我按下 UITableView 的第一行时,都不会调用 didDeselectRowAtIndexPath 方法。我目前的代码如下。

# pragma  mark - UITableViewDelegate & UITableViewDataSource

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [self.ary_tblDisplay count];
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
return 80;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"TableCell";

UIView *colorView,*backgroundView;
UILabel *lblCode,*lblStatus,*lblDate;
UITableViewCell *cell = (UITableViewCell *) [self.tbl_claims dequeueReusableCellWithIdentifier:CellIdentifier];
cell = nil;
if (cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}

colorView = [[UIView alloc] initWithFrame:CGRectMake(7, 5, 5, 70)];
[cell addSubview:colorView];

backgroundView = [[UIView alloc] initWithFrame:CGRectMake(12, 5, 306, 70)];
backgroundView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"LightGreen"]];
[cell addSubview:backgroundView];

lblCode = [[UILabel alloc] initWithFrame:CGRectMake(20, 7, 140, 40)];
lblCode.text = [[self.ary_tblDisplay objectAtIndex:indexPath.row] claim_code];
lblCode.backgroundColor = [UIColor clearColor];
lblCode.textColor = [UIColor blueColor];
lblCode.font = [UIFont boldSystemFontOfSize:18];
[cell addSubview:lblCode];

lblStatus = [[UILabel alloc] initWithFrame:CGRectMake(20, 40, 140, 35)];
lblStatus.backgroundColor = [UIColor clearColor];
lblStatus.text = [[self.ary_tblDisplay objectAtIndex:indexPath.row] claim_status];
[cell addSubview:lblStatus];

lblDate = [[UILabel alloc] initWithFrame:CGRectMake(150, 20, 120, 40)];
lblDate.backgroundColor = [UIColor clearColor];
lblDate.text = [[self.ary_tblDisplay objectAtIndex:indexPath.row] accepted_date];
[cell addSubview:lblDate];

if ([lblStatus.text isEqualToString:@"Rejected"])
colorView.backgroundColor = [UIColor redColor];
else if ([lblStatus.text isEqualToString:@"Accepted"])
colorView.backgroundColor = [UIColor greenColor];
else if ([lblStatus.text isEqualToString:@"In-Progress"])
colorView.backgroundColor = [UIColor blueColor];

cell.selectionStyle = UITableViewCellSelectionStyleNone;
cell.backgroundColor = [UIColor redColor];
return cell;
}

- (void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath
{
StatusViewController *obj_StatusViewController = [[StatusViewController alloc] initWithNibName:IS_IPHONE_5?@"StatusViewController":@"StatusViewController_3.5" bundle:nil];
obj_StatusViewController.details = [self.ary_tblDisplay objectAtIndex:indexPath.row];
[self.navigationController pushViewController:obj_StatusViewController animated:YES];
}

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com