1

これは既存のバグなのか、それともこれを修正する方法があるのだろうかと思っていました。テーブルビューでナレーションをオンにすると、テーブルセルが空になります...誰か?

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

//Exisint bug if using TableViewCell
TableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
    cell = [[TableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
// Configure the cell.
cell.pLabel.text = [self.tableArrayPlaces objectAtIndex:[indexPath row]];

return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

NSString *selectedDest = [tableArrayPlaces objectAtIndex:indexPath.row];

//Get the selected country
NSLog(@"SelectedDest %@", selectedDest);
}

編集:コードが追加されました。これは私のセルにデータを入力するための私のコードです。ストーリーボードでは、「プッシュ」に設定しましたが、機能しないようです。何か助けはありますか?

4

2 に答える 2

0

iOSまたはコードのバグである可能性がありますが、Xcodeのバグではない可能性があります。

テーブルビューコントローラの-tableView:cellForRowAtIndexPath:メソッドを確認してください。空のセルが生成されたときに呼び出されますか?いいえの場合、なぜですか?はいの場合、適切にフォーマットされたセルを返しますか?連絡先などの他のアプリケーションで問題を再現できますか?

于 2012-04-16T14:29:53.527 に答える
0
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"tableCell";

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
    cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
// Configure the cell.    
cell.text = [tableArrayPlaces objectAtIndex:[indexPath row]];

return cell;
}

独自のcellViewを使用する代わりに、UITableViewCellを使用しました。これで私の問題は解決します。しかしもちろん、ストーリーボードで直接リンクすることはできなくなりました。

于 2012-04-17T04:05:10.217 に答える