-2

表示時にデータベースからデータをロードするテーブルビューコントローラーを構築しようとしています。

そのデータをユーザーに表示した後、テーブルは更新のために Web サービスをポーリングします。データはユーザーに表示され、Web サービスが応答するとリロードされます。

これはコントローラーです:

- (void) viewDidAppear:(BOOL)animated
{
    NSLog(@"in view did appear");
}

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:@"menuView" bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
}
return self;


}

- (id)initWithStyle:(UITableViewStyle)style
{
    self = [super initWithStyle:style];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
   [super viewDidLoad];

   // make space between the start of the screen and the start of th table
   [self.tableView setContentInset:UIEdgeInsetsMake(80,0,0,0)];


   // connect to database
   database = [[connectToDB alloc] init];
   [database setDelegate:self];


   // fill the table from the DB
   [database selectSqlQuere:@"SELECT * FROM ZTASKS"];


   // refresh when table scroll down
   UIRefreshControl *refreshControl = [[UIRefreshControl alloc] init];
   [refreshControl addTarget:self action:@selector(refresh:)     forControlEvents:UIControlEventValueChanged];
 [self.tableView addSubview:refreshControl];

 }
- (void)didReceiveMemoryWarning
 {
  [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

 #pragma mark - Table view data source


 @end

Web サービスのポーリング中にテーブルをユーザーに表示したままにし、Web サービスが応答したときにテーブルを更新するにはどうすればよいですか?

4

2 に答える 2