0

私はiPhoneアプリケーションに取り組んでいますが、何か奇妙なことが起こります。アドバイスをお願いできると思います。

新しいオブジェクトの作成フォームとして、TableViewとカスタムビューを実装しました。以下のコードのように、TableViewのツールバーのユーザータブの[追加]ボタンを押すと、カスタムビューが上にスライドします。

- (void)slide_up_form:(id)sender {

    CustomViewController *controller = [[CustomViewController alloc] init];

    // Assign this controller to use add_entity: message to TableView.
    controller.parent = self;

    [self presentModalViewController:controller animated:TRUE];
}

// To update TableView presentation.
-(void)add_block:(Block *)newBlock
{
 [blockArray insertObject:newBlock atIndex:0];
 NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:0];
 [self.tblCameraList insertRowsAtIndexPaths:[NSArray arrayWithObject:indexPath]
                              withRowAnimation:UITableViewRowAnimationNone];

        [self.tblCameraList scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]
                         atScrollPosition:UITableViewScrollPositionTop animated:YES];

 }

カスタムビューでは、ユーザーはフォームに入力して[保存]ボタンをクリックします。そのため、エンティティをCoreデータに保存しました。TableViewを新しいオブジェクトで更新する必要があるため、カスタムビューで次のステートメントをコーディングします。

@synthesize parent;

- (void)save_block:(id)sender {
// save entity.

[self.parent add_block:newBlock];

// Slide down the custom view and show the TableView.
[[self parentViewController] dismissModalViewControllerAnimated:TRUE];
}

私はこれをシミュレーターとiPhoneですでにテストしました。ユーザータブの[保存]ボタンを押すと、アプリケーションは新しいエンティティを保存しましたが、TableViewを新しいエントリで更新しません。

この問題を解決するためのアドバイスをいただけますか?

4

1 に答える 1