Tab Bar Controller- switch UIView within one tab

2019-09-13 02:24发布

ok here is my applications setup: Two xib's

MainWindow.xib NewsletterView.xib

Set up as follows: MainWindow.xib Files owner First Responder The Delegate Window Tab Bar Controller--setup to load tabs from .xib's Two tabs -Newsletter -Map

I'm not concerned about the Map tab.

Within the NewsletterView.xib ( i do have the .h and .m files setup)

Files owner set up with class NewsletterViewController via interface builder.
First Responder
and Two views:
View- setup as NewsSignUpView via IBOutlet - this is the first view that loads on the selected tab.
View - setup as NewsReaderView via IBOutlet

I want to be able to click a button (assigned via IBAction) on NewsSignUpView the flip horizontally to reveal NewsReaderView.

This is what i have so far:

-(IBAction) revealNewsReaderView 
{CGContextRef context = UIGraphicsGetCurrentContext();
[UIView beginAnimations:nil context:context];
[UIView setAnimationTransition: UIViewAnimationTransitionFlipFromLeft forView:newsSignUpView cache:YES];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationDuration:1.0];  
[self.view exchangeSubviewAtIndex:0 withSubviewAtIndex:1];
[UIView commitAnimations];
}

This Flips the view but doesn't change the view shown.

Can anyone provide some code, or point out where im going wrong?

Thanks in advance.

1条回答
Bombasti
2楼-- · 2019-09-13 03:21

You can download the apple's sample to see implementation of flipping between two views in same frame. http://developer.apple.com/library/ios/#samplecode/UICatalog/Introduction/Intro.html

查看更多
登录 后发表回答