views:

1301

answers:

1

hello all i am using this code to show flip animation...... i have a uiview with scrollview(paging enabled)...so it shows a view like a page...now i also have done flip animation using this code....

-(void)flipView
{
    flashCardAnswerController *flashCardAnswerControllerobj =  [[flashCardAnswerController alloc] initWithNibName:@"FlashCardAnswerView" bundle:[NSBundle mainBundle]];
[flashCardAnswerControllerobj.view setFrame:[[self view] frame]];
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.60];// Sub. duration  
UIView *superview;
     if ((superview = [[self view] superview])) {
 [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft   forView:superview cache:YES];
 [superview addSubview:[flashCardAnswerControllerobj view]];
}
[UIView commitAnimations];
}

so according to code the new view will be added to scrollview..i also manage to release the new view while flipping back...but if i directly push the back button on navigaion controller...the flip side view won't release. i tried this in dealloc method of my scrolleview's class but it doesn't work

for(UIView *subview in [scrollView subviews]) {
     [subview removeFromSuperview];
}

how do i remove flipside's view the views are very much in number...approx. 48 plus 48 flip side views so definietly it will create memory issues on device...

also could someone tell me a way to disable NavigationBar's back button in flip side view...without creating scolling class's object.

+1  A: 

I do not have a direct answer to your question, but I can tell that this is the old iPhone OS 2.x way of displaying a views flip-side.

In iPhone OS 3.0 you should use presentModalViewController:animated: instead. This is much less code, and all of the problems you describe in your questions goes away.

The idea is that the flip-side of the current view, is managed by a separate UIViewController that you display modally. But in addition to the sliding animation from 2.0 you can also have the new view controller animate in and out with a horizontal flip.

self.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:flipSideController
                        animated:YES];
PeyloW
yes i have 2.x os.tell me how to release flip side's view...
Rahul Vyas
You should really, really carefully ask yourself; will a user who can not bother to install iPhone OS 3.0 bother to install my app?In the unlikely event that the answer is yes; add flip-side subview to a superview further up the view hierarchy, possibly as a child view to your UIWindow instance. That way the navigation bar is no longer there, and back button is no problem. Requiring the user to flip back a page, before going to the next is not a problem, see Weather.Also you never need to release subviews in the dealloc method, the default implementation in UIView already do that for you.
PeyloW
adding in windows doesn't works... Isn't there a way i can find out if scrollView Has Subview of class FlipSide i could release if ScrollView Has Flip Side View
Rahul Vyas