2011-12-23 10 views
-1

私は部門のクリックで、コードがIOS 3.0と4.o に適していますとき、私は、コードを実行すると、コードがテーブルビューをクリックしてIOS 5.0で実行するとアプリケーションがクラッシュする。

- (NSArray*)indexPathsInSection:(NSInteger)section { 
     NSMutableArray *paths = [NSMutableArray array]; 
     NSInteger row; 

    for (row = 0; row < [self numberOfRowsInSection:section]; row++) 
      { 
    [paths addObject:[NSIndexPath indexPathForRow:row inSection:section]]; 
     } 

    return [NSArray arrayWithArray:paths]; 
} 
- (void)toggle:(BOOL*)isExpanded section:(NSInteger)section { 
     *isExpanded = !*isExpanded; 


    [Table beginUpdates]; 
    if (!*isExpanded) 
     { 
     NSArray *paths = [self indexPathsInSection:section]; 
      [Table deleteRowsAtIndexPaths:paths withRowAnimation:UITableViewRowAnimationFade]; 

     } 
    else { 
      NSArray *paths = [self indexPathsInSection:section]; 
      [Table insertRowsAtIndexPaths:paths withRowAnimation:UITableViewRowAnimationRight]; 
      } 


    [Table endUpdates]; 
    [Table reloadData]; 
    } 
- (NSInteger)numberOfRowsInSection:(NSInteger)section { 

if(kMAX_SECTION_ROWS[section] == 0) 
{ 
    return 1; 
} 
else 
{ 
    return kMAX_SECTION_ROWS[section]; 
} 
//return 0; 
} 

    - (void)toggleSection:(id)sender { 
    NSLog(@"button %d is clicked.",[sender tag]); 
int i = [sender tag]; 
if(!isSectionExpanded[i]){ 
    NSLog(@"expanded"); 
    hString[i].arrowImage.image = [UIImage imageNamed:@"downarrow.png"]; 
} 
else { 
    NSLog(@"not expanded"); 
    hString[i].arrowImage.image = [UIImage imageNamed:@"arrowgrean.png"]; 
} 

[self toggle:&isSectionExpanded[i] section:i]; 
} 

のように見えるの細胞の退色を表示するコードを行っていますIOS 5それは私を示し、エラー

 Assertion failure in -[_UITableViewUpdateSupport _computeRowUpdates],/SourceCache/UIKit_Sim/UIKit-1912.3/UITableViewSupport.m:386    

は、任意の手掛かりは、その後のおかげ

+0

これまでにバグを追跡するために何をしましたか? – Monolo

+0

私は番号を確認しようとしました。テーブルビューのセクションと実行時のnセクションの行数を取得しました。これはIOS 3.0と4.0でうまくいきます。 – bhavin

+0

ありがとうございましたが、今は別の方法で処理しています – bhavin

答えて

0

こんにちは友人:私は、これは時間 のあなたのたくさんの感謝を節約すると思います http://soulwithmobiletechnology.blogspot.com/2011/06/how-does-uitableviewcell-reorder.html

+0

私は同じ問題に直面しているが、あなたの提案されたlink.Canからこれを解決するためにいくつかの他のリンクを投稿する助けを得なかった。 – Purva

+0

私はまた、その問題を解決することができませんでしたので、私は上記のリンクからのコードを使用し、私の最後のプロジェクトの1つで行うことができます。そこからも使用することができます。 – bhavin

0

を返信する場合はたぶん、iOS5をあなたが言う事についてもっとうるさいです。あなたは

if(kMAX_SECTION_ROWS[section] == 0) 

を書くとき、あなたは本当に0と1ではない(または他のどこか他のセクションヘッダを返す)を返す必要があります。私はいずれかがそれだけに行きたいので、すべてのIOS上で動作し、同じソース見つかっブログ持っている

+0

ありがとうあなたのサポートが、私はそれが起こるように別の方法を持っている – bhavin

関連する問題