2009-05-27 10 views
1

私はこの本当に奇妙なバグを持っています。テーブルビューを下にスクロールすると、「説明」というセクションが表示され、このセクションのセルは表示されません。代わりに、セクションのタイトルが何度も何度も繰り返されます。 iPhoneの画面表示を担当している人は、何も表示されずに画面に表示されているものが見つからないように聞こえます(スクロールしたのでセクションのタイトルです)。デバイスに奇妙なバグがあります:UITableViewのセル内容が表示されません

スクリーンショットを撮ると、セルの代わりに黒い背景が表示されます。

このバグはシミュレータでは発生しませんが、実際のデバイスでのみ発生します。

誰もこの種のことに会ったことがありますか?あなたはどこに問題があるのか​​推測できますか?

答えて

0

私は解決策を見つけました...それは明らかでしたが、まだ...

私のUILabelのサイズは2048ピクセルを超えています。私たちはそれより大きいサイズを使用することは許されません。それがレンダリングがとても奇妙な理由です。

このスレッドはstackoverflow.com/questions/773386/inserting-various-views-into-uiscrollviewは既にその問題に対処しています。

0

単語の説明を他のものに変更してみてください。 Objective Cのクラスは、オブジェクトがNSStringで記述できるメソッドを表すために、descriptionという語を使用します。名前を変更するとその名前が修正されると、あなたのバグはそれに関係します。

あなたは、このような作業で記述を見ることができます:

NSString *aString = [[NSString alloc] initWithFormat:@"hi"]; 
NSLog(@"%@", [aString description]); 
+0

いいえ、私は試しましたが、何も変更していません... – Unfalkster

+0

セクションヘッダー「説明」は問題を起こしてはいけません。それは普通の文字列です! – lostInTransit

0

は、私がここにコードを配置します、ご回答いただきありがとうございます。しかし、私のコードは他のすべてのセルでうまく機能するので、このセルの特定の内容に関連しなければならないことを覚えておいてください...

ビデオをチェックアウトすることを躊躇しないでください私は作った、それはiPhoneのための非常に興味深い動作です、あなたもそれを見たことがありますか? dl.free.fr/rlQmFyWS0

ここではcellForRowAtIndexPathのコードです:メソッド、説明のセルに関係ほんの一部:

case 3: // A big cell containing the description 
    { 
     // Try to find an already allocated cell with the description (note : there is only one description cell per table so no need to check the content...) 
     UITableViewCell * descriptionCell = [tableView dequeueReusableCellWithIdentifier:kTextCellIdentifier]; 
     if (descriptionCell == nil) { 
      // As a frame, use the description label's one plus a little margin for the height 
      descriptionCell = [[[UITableViewCell alloc] initWithFrame:CGRectMake(0, 0, tableView.frame.size.width, self.descriptionText.frame.size.height + (2*kCellInset)) reuseIdentifier:kTextCellIdentifier] autorelease]; 
      descriptionCell.selectionStyle = UITableViewCellSelectionStyleNone; 
      // The descriptionText UILabel has been previously initialized properly by tableview:heightForRowAtIndexpath: method 
      [descriptionCell.contentView addSubview:self.descriptionText]; 
     } 
     return descriptionCell; 

そして、ここでは、私がdescriptionTextフィールドを初期化する部分である。

// Customize row height for each cell 
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { 
if (indexPath.section == 3) { 
    CGSize realSize; 
    if (self.descriptionText != nil) { 
     // the description has been previously initialized 
     realSize = descriptionText.frame.size; 
    } 
    else { 
     // We need to dynamically resolve the height for the description zone 
     NSString * desc = (NSString *)[product objectForKey:@"description"]; 
     UILabel * descLabel = [[UILabel alloc] initWithFrame:CGRectZero]; 
     // Unlimited number of lines 
     descLabel.numberOfLines = 0; 
     descLabel.text = desc; 
     // Set a preferred width and anything for the height 
     realSize = [descLabel sizeThatFits:CGSizeMake(tableView.frame.size.width - (2*kCellInset), 1)]; 
     // Take the opportunity to set the frame with the correct values 
     descLabel.frame = CGRectMake(kCellInset, kCellInset, realSize.width, realSize.height); 
     self.descriptionText = descLabel; 
     [descLabel release]; 
    } 
    return (realSize.height + (2*kCellInset)); 
} 
else { 
    return kImageCellHeight; 
} 
return 0; 

}

どれ推測は歓迎以上だろう...私はここに

を調査しておきます0
関連する問題