我在顶部有一个导航栏,在底部有一个标签栏。然后我在导航栏上放了一个信息灯按钮。我的任务是按下info按钮将中间区域切换到另一个视图,并保持导航栏和选项卡栏静止不动。
-(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];
}用这个我用翻转的方式切换屏幕,但它切换了整个屏幕。我要让标签栏静止不动。我也不想要标签栏开关。
发布于 2011-07-28 12:15:13
现在还不清楚你想要实现什么。
如果您想要一个模式视图,那么您应该使用类似于
[self presentModalViewController:navController animated:YES];这样,您的前一个屏幕将以相同的方式离开,除非您取消它。如果您打算在您的模式视图中有一个导航和一个选项卡栏,那么将该视图声明为一个TabBarController,您就可以为它提供一个navigationBar。
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:infoView];
navController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:navController animated:YES];发布于 2011-07-28 12:15:56
像这样的东西“
-(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) {
}];
}https://stackoverflow.com/questions/6853685
复制相似问题