を変更していない:のUITableViewCellのtextLabelのフォントの変更は、視覚
Fonts.xibはのUIViewControllerのサブクラスであるフォントオブジェクトによって制御されるだけのUITableViewとUIViewのある[(UINavigationController *)self.parentViewController pushViewController:[[[Fonts alloc] initWithNibName:@"Fonts" bundle:nil] autorelease] animated:YES];
とUITableViewのdataSourceとdelegateとして機能します。フォントオブジェクトで
は、私のようなのUITableViewCellを作成:- (UITableViewCell *) tableView: (UITableView *) tableView cellForRowAtIndexPath: (NSIndexPath *) indexPath {
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier: @"BlahTableViewCell"];
if (!cell) {
cell = [[UITableViewCell alloc]
initWithStyle: UITableViewCellStyleDefault
reuseIdentifier: @"BlahTableViewCell"];
[cell autorelease]; // Delete for ARC
}
return cell;
}
そして私はここで、セルのフォントを変更:
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
[cell.textLabel setFont:[(UIFont *)[self.listOfFonts objectAtIndex:indexPath.row] fontWithSize:cell.textLabel.font.pointSize]];
cell.textLabel.text = [(UIFont *)[self.listOfFonts objectAtIndex:indexPath.row] fontName];
}
listOfFontsがUIFontオブジェクトのNSArrayのです。
ビューは、私がのUITableViewにreloadDataを呼び出すか、私は私の指で画面をオフUITableViewCellsをドラッグして、彼らが再描画され立ち直るせて、ビューならば、細胞がで表示する場合、それはUITableView without changed fonts
ようになります表示されますフォントが変更されたラベル。
UITableViewCellsがあまりにも早く描画されているように見えます。私はそれらの図面を延期する場合はすべて正しいように見えますが、UINavigationControllerが私のビューを所定の場所にスライドさせると、UITableViewが正しく表示されるようにします。
私が間違っていることは何ですか?
EDIT:問題の簡単な例をDropboxにアップロードしました。 http://dl.dropbox.com/u/5535847/UITableViewIssue.zip
なぜ、 'cellForRow'メソッドでこれをしないのですか? –
@RomanTemchenkoテーブルセルのUIの変更(背景色とフォントなど)は、 'tableView:willDisplayCell:' –
で行われるはずです。 –