I have a UITableView
controller displaying static tableview
. I have to update the project providing a secondary mode where this tableview
is supposed to flip and to show different data. My approach would be to put all the static cells of both modes in one big static tableview
, to perform a flip and to hide the cell which are not required at that specific moment. The flip should be performed only on the tableviewcontrollerview
,so not affecting the navigationbar
or the main tabbar
. The code I've been trying to use so far for realising this simple magic trick is:
// Transition using a page flip.
[UIView transitionFromView:self.tableview
toView:self.tableview
duration:0.7
options:UIViewAnimationOptionTransitionFlipFromLeft
completion:^(BOOL finished) {
if (finished) {
/* HIDE NOT REQUIRED CELL */
}
}];
Unfortunately the result is a black screen. Any idea how to fix it?
Try using the below code instead:
[UIView transitionWithView:self.tableView
duration:0.7
options:UIViewAnimationOptionTransitionFlipFromLeft
animations:^{
/* any other animation you want */
} completion:^(BOOL finished) {
/* hide/show the required cells*/
}];
I think the main problem is, that views can have max one superview. Which means a view can not be in two places in the same time. I would try capture the view as image and add it on its superview just before animation and remove the real tableview from its superview. And then you can animate between two different views (image view and table view). In completion block just remove the image view.
How to capture the view :How to capture current view screenshot and reuse in code? (iPhone SDK)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With