2012-01-31 9 views
-1

私は UITableViewControllerを持っており、動的にサイズ変更可能なセルを作成します。セルは、テキストの内容とフォントサイズに応じてセルのサイズを変更します。 (先端はこちらをご覧ください。)この廃止予定のメソッドの代わりに、どのような呼び出しを使用する必要がありますか?

それは廃止されて、次のメソッドの呼び出しを使用しています。私は代わりに、私の機能を保ち、使用する方法を把握することができていない

cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease]; 

。 Appleのマニュアルには参考文献はありません。

どうすればこの問題を解決できますか?

+0

も参照してください[initWithFrame:reuseIdentifier:廃止されました](http://stackoverflow.com/questions/6967506/initwithframe-reuseidentifier-is-deprecated) –

答えて

1

このようなものを試してみてください。

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Standard"]; 
if (cell == nil) { 
    cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"Standard"] autorelease]; 
} 
1
static NSString *CellIdentifier = @"Cell"; 

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 
if (cell == nil) 
    cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; 
2

The documentation、具体的に述べ:

のiOS 3.0で非推奨

を。代わりにinitWithStyle:reuseIdentifier:を使用してください。

+0

私は_initWithFrame_を検索し、私は私が見つけた間違っ_initWithFrame_を見つけましたこの情報への参照はありません。私の悪い:( –

関連する問題