如何用屏幕的一部分切换视图

发布于 2024-11-26 23:29:36 字数 804 浏览 6 评论 0原文

我的顶部有一个导航栏,底部有一个标签栏。然后我在导航栏上放置一个信息灯按钮。我的任务是按信息按钮将中间区域切换到另一个视图,并保持导航栏和选项卡栏保持静止。

-(IBAction) infoButtonPressed:(id)sender
{
BMIInfo *infoView = [[BMIInfo alloc] initWithNibName:nil bundle:[NSBundle mainBundle]];

infoView.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self.navigationController pushViewController:infoView animated:YES];
[infoView release];

}

使用上面的代码,我只像平移移动一样进行视图切换。我希望有一个翻转动作。我该怎么办?

- (IBAction)infoButtonPressed:(id)sender;
{
BMIInfo *infoView = [[BMIInfo alloc] initWithNibName:nil bundle:nil];

infoView.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:infoView animated:YES];

[infoView release];
}

有了这个,我以翻转方式切换屏幕,但它切换了整个屏幕。我希望标签栏保持静止。我也不想要标签栏开关。

I have a navigation bar on the top and a tab bar on the bottom. Then I place a info light button on the navigation bar. My task is press the info button to switch the middle area to another view and keep the navigation bar and the tab bar standing still.

-(IBAction) infoButtonPressed:(id)sender
{
BMIInfo *infoView = [[BMIInfo alloc] initWithNibName:nil bundle:[NSBundle mainBundle]];

infoView.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self.navigationController pushViewController:infoView animated:YES];
[infoView release];

}

with this code above, I only made the view switching like a translation move. I wish to have a flip move. How can I do?

- (IBAction)infoButtonPressed:(id)sender;
{
BMIInfo *infoView = [[BMIInfo alloc] initWithNibName:nil bundle:nil];

infoView.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:infoView animated:YES];

[infoView release];
}

and with this one I switch the screen on the flip way but it switch the whole screen. I want the tab bar stand still. I don't want the tab bar switch too.

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

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

发布评论

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

评论(2

少女的英雄梦 2024-12-03 23:29:36

目前尚不清楚您想要实现什么目标。

如果您想要模式视图,那么您应该使用类似

[self presentModalViewController:navController animated:YES];

这样的方法,除非您将其关闭,否则您之前的屏幕将以相同的方式保留。如果您打算在模式视图中拥有导航和选项卡栏,则将该视图声明为 TabBarController,并且可以以模式方式为其提供导航栏。

UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:infoView];

navController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:navController animated:YES];

It's not clear what you are trying to accomplish.

If you want a modal view, then you should use something like

[self presentModalViewController:navController animated:YES];

This way your previous screen will be left in the same way unless you dismiss it. If you intend to have a navigation and a tab bar in your modal view, then declare that view as a TabBarController, and you can modally provide it a navigationBar.

UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:infoView];

navController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:navController animated:YES];
拧巴小姐 2024-12-03 23:29:36

像这样的东西”

-(IBAction) infoButtonPressed:(id)sender
{
BMIInfo *infoView = [[BMIInfo alloc] initWithNibName:nil bundle:[NSBundle mainBundle]];


[UIView animateWithDuration:1 delay:0 options:UIViewAnimationOptionTransitionFlipFromLeft animations:^(void) {
    [self.navigationController pushViewController:infoView animated:NO];
     [infoView release];
} completion:^(BOOL finished) {

}];




}

Something like this"

-(IBAction) infoButtonPressed:(id)sender
{
BMIInfo *infoView = [[BMIInfo alloc] initWithNibName:nil bundle:[NSBundle mainBundle]];


[UIView animateWithDuration:1 delay:0 options:UIViewAnimationOptionTransitionFlipFromLeft animations:^(void) {
    [self.navigationController pushViewController:infoView animated:NO];
     [infoView release];
} completion:^(BOOL finished) {

}];




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