2012-01-21 7 views
1

私は働いているiPhoneアプリを持っていて、sms.appのように大きく動作します。基本的に、キーボードをクリックすると、キーボードが表示されたときに収まるようにtableViewが縮小されます。そして、それをクリックすると隠れ、TableViewは元の高さに戻ります。奇妙なUITableViewCellのアニメーションは、UITableViewフレームを変更するとき

私の問題は、私のUITableViewフレームを元のサイズに戻すと、表示されていないセルが表示される前に奇妙なアニメーションが表示されていたことです。私は主に画像のために伝えることができます。彼らは中心に向かって大きなものから始まり、どこにあるべきかにリサイズします。これはUITableViewの設定ですか?それとも私のコードですか?次の2つの異なるスタイルに二回のUITableViewのスタイルを設定している

// Customize the appearance of table view cells. 
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 

static NSString *CellIdentifier = @"Cell"; 

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

// InitWithStyle 
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease]; 

cell.selectionStyle = UITableViewCellSelectionStyleNone; 
cell.backgroundColor = [UIColor clearColor]; 
cell.contentView.backgroundColor = [UIColor clearColor]; 

// Add subviews here! EX: 
// [[cell contenView] addSubview:theObject]; 

} 

答えて

0

デフォルト:

cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; 

と字幕:ここでは、どちらのスタイルあなたが希望する

cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];` 

セットもう一方を削除します。

if (cell == nil) { 
    cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; 

これで、必要に応じて新しいセルを作成し、別のスタイルの別のセルを作成します。

+0

はい、それが問題でした。しかし、今私のテーブル全体のビューは台無しです。私はあなたが言ったように 'if(cell == nil){ cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];'を実行し、サブビューを追加してから '}'を閉じました。何かご意見は? – iosfreak

+0

UITableViewCellStyleSubtitleを試しましたか?私はそれが2番目に作られていたので –

関連する問題