Tab Bar Controller- switch UIView within one tab

放肆的年华 提交于 2019-12-12 01:14:25

问题


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:


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



来源:https://stackoverflow.com/questions/4319584/tab-bar-controller-switch-uiview-within-one-tab

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!