标签栏控制器 - 在一个标签内切换 UIView

发布于 2024-10-06 01:12:33 字数 1024 浏览 0 评论 0原文

好的,这是我的应用程序设置: 两个xib的

MainWindow.xib NewsletterView.xib

设置如下: 主窗口.xib 文件所有者 急救人员 代表 窗户 选项卡栏控制器 - 设置从 .xib 加载选项卡 两个选项卡 - 时事通讯 -地图

我不关心“地图”选项卡。

在 NewsletterView.xib 中(我确实有 .h 和 .m 文件设置)

文件所有者通过界面生成器使用类 NewsletterViewController 设置。
急救人员
和两个视图:
视图 - 通过 IBOutlet 设置为 NewsSignUpView - 这是在所选选项卡上加载的第一个视图。
视图 - 通过 IBOutlet 设置为 NewsReaderView

我希望能够单击 NewsSignUpView 上的按钮(通过 IBAction 分配)水平翻转以显示 NewsReaderView。

这就是我到目前为止所拥有的:

-(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];
}

这会翻转视图,但不会更改显示的视图。

谁能提供一些代码,或者指出我哪里出错了?

提前致谢。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

ぇ气 2024-10-13 01:12:33

您可以下载苹果的示例来查看同一帧中两个视图之间翻转的实现。
http://developer.apple.com/library/ios/ #samplecode/UICatalog/Introduction/Intro.html

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文