應用程序就像這樣工作,它是一個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 –