アプリ内で単一の UITableView を使用しています。行の選択などに応じて、UITableView のデリゲートとデータソースを変更します。
ユーザーの動きに合わせてトランジションをアニメーション化するには、現在の UITableView の画像を取得し、UITableView の上に配置された UIImageView に画像を配置し、UITableView で Data を再ロードしてから、アニメーション化されたトランジション内の UIImageView を削除します。
次のようにコードします。
-(void)showImageEditPageWithImageId:(NSString*)imageId
{
UITableView* tableview = (UITableView*)[self.view viewWithTag:VIEWTAG_P1_MAINTABLEVIEW];
UIImage* image = [HPSImageHelper imageWithView:tableview];
UIImageView* imageView = [[UIImageView alloc] initWithFrame:tableview.frame];
imageView.tag = 336611;
imageView.layer.borderWidth=1;
imageView.layer.borderColor = [UIColor blueColor].CGColor;
[imageView setImage:image];
_tableViewController = [[HPSImageEditTableViewController alloc] initWithImageId:imageId];
((HPSImageEditTableViewController*)_tableViewController).callingController = self;
tableview.dataSource = _tableViewController;
tableview.delegate = _tableViewController;
[tableview reloadData];
[tableview.superview addSubview:imageView];
[NSTimer scheduledTimerWithTimeInterval:0.1
target:self
selector:@selector(removeCoveringImage)
userInfo:nil
repeats:NO];
}
-(void)removeCoveringImage
{
UIView* imageView = [self.view viewWithTag:336611];
[UIView transitionWithView:imageView
duration:0.9
options:UIViewAnimationOptionTransitionCurlUp
animations:^{
//Nothing here
}
completion:^(BOOL finished){
[imageView removeFromSuperview];
}
];
}
問題は、遷移が完了すると UITableView が視覚的にのみ更新されるため、新しいビューが突然表示されることです。
UITableView は、実際には表示されていないことを「認識」しているため、更新されていないように思えます。
それが起こっているのですか?もしそうなら、UIImageViewで覆われているにもかかわらず、UITableViewを再描画するにはどうすればよいですか?
ありがとう。