应用程序就像这样工作,它是一个UITableView,它显示所有位于同一范围内的信标。然后用户可以选择一个信标。在接下来的UITableVi中,我想展示他们选择的信标,所有关于信标的信息,其中一个信息是每隔0.2秒改变一次值的RSSI。我将这些信息传递到下一页。只显示一个单元UITableView
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Tag"];
AXABeacon *beacon = [[AXABeacon alloc] init];
beacon = [self.sortedDevices objectAtIndex:indexPath.row];
if([_beaconSelected.name isEqualToString:beacon.name])
{
UILabel *titleLabel = (UILabel *)[cell viewWithTag:1];
UILabel *uuidLabel = (UILabel *)[cell viewWithTag:2];
UILabel *rssiLabel = (UILabel *)[cell viewWithTag:3];
UILabel *majorLabel = (UILabel *)[cell viewWithTag:4];
UILabel *minorLabel = (UILabel *)[cell viewWithTag:5];
titleLabel.text = [NSString stringWithFormat:@"%@", beacon.name];
uuidLabel.text = [NSString stringWithFormat:@"%@", beacon.uuidString];
rssiLabel.text = [NSString stringWithFormat:@"RSSI: %@", [beacon.rssi stringValue]];
minorLabel.text = [NSString stringWithFormat:@"Minor: %@", beacon.minor];
majorLabel.text = [NSString stringWithFormat:@"Major: %@", beacon.major];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
uuidLabel.adjustsFontSizeToFitWidth = YES;
titleLabel.adjustsFontSizeToFitWidth = YES;
cell.accessoryType = UITableViewCellAccessoryNone;
}
return cell;
}
以下是我目前的工作情况。这可行,但问题是这种方法不断搜索信标,当它发现另一个信标它显示一个空单元格。我不想让它显示另一个单元格。我希望它只显示他们选择的灯塔的信息。我该怎么做?
那么,为什么你只有一个项目要显示时使用表格视图? – Wain
为什么只用一个单元格使用表格视图?为什么不使用所需标签的普通视图控制器?为什么这个视图控制器,用来显示一个设备的细节,有多个设备的参考? – rmaddy
我现在面临的问题是,我必须向每个0.2秒显示RSSI值的人员。 RSSI与用户从第一个UITableView选择一个信标并保持不变的情况相同。我希望对象始终更新其信息。 @maddy –