2011-12-22 9 views
0

私のアプリケーションでは、新しいデータが読み込まれたときにリロードするPopoverのUITableViewがあります。Sectioned UITableView refreshing

通知、リロードを開始:

- (void)recieveNotification:(NSNotification*) notification { 
if ([[notification name] isEqualToString:@"NewDataArrived"]) { 
    [self viewWillAppear:YES]; 
} 

方法リロードする:表が区分されていない場合、すべてこのコードで完璧に動作します

- (void)viewWillAppear:(BOOL)animated 
{ 
//Formation of the new content of table 

[self.tableView reloadData]; 
[super viewWillAppear:animated]; 
} 

をしかし、セクションによって、私の並べ替えコンテンツならば、すべてが行きます混乱に。最後のセクションにテーブルの最後に追加するだけで、リロードと新しいデータを表示しません。セクションの

ヘッダ:

- (NSString*)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section 
{ 
if (section == 0) { 
    return @"Cities"; 
} else 
    if (section == 1) { 
     return @"Hotels"; 
    } else 
     if (section == 2) { 
      return @"Airports"; 
     } else 
return @"Landmarks"; 
} 

Here is screenshot http://dl.dropbox.com/u/8288064/img/chaos.png

私はこのトラブルに多くの時間を費やしており、アドバイスに感謝します。

答えて

1

このようにしてください!!!!

の.h

-(void)myOwnMethod:(id)sender; 

.M

-(void)myOwnMethod:(id)sender{ 

    [self.tableView reloadData]; 


} 
- (void)recieveNotification:(NSNotification*) notification { 
    if ([[notification name] isEqualToString:@"NewDataArrived"]) { 
      // [self viewWillAppear:YES]; 

     [self myOwnMethod]; 

    } 
} 
+0

いや、それは残念ながら、動作しませんでした。 – Akki

+0

むしろ、セクション化されていないテーブルビューでも機能します。 – Akki