从标签栏应用程序模板XCode动画新视图

时间:2011-04-24 05:59:18

标签: iphone xcode views switching uitabview

我在xcode中创建了一个新的Tab Bar Application模板。当按下按钮时,如何正确设置动画(向上滑动)的新视图?我已经看到使用NavigationController完成了这个。

我添加了一个导航栏和一个按钮,其中包含使用以下代码添加子视图的操作:

(IBAction)newPost:(id)sender
{
    // Load UIViewController from nib
    PostViewController *screen = [[PostViewController alloc] initWithNibName:@"PostViewController" bundle:nil];

    // Add to UINavigationController's stack, i.e. the view for this UITabBarController view
    [self.view addSubview:screen.view];

    // Release music, no longer needed since it is retained by the navController
    [screen release];
}

1 个答案:

答案 0 :(得分:0)

我不确定这是不是你问的问题,但是如果你只是想让一个新的视图控制器以模态向上呈现,那么就这样做。

1。)新文件 - >查看控制器

2)。

newViewcontroller *viewController = [[newViewcontroller alloc] initWithNibName:@"newViewcontroller" bundle:nil];
[self presentModalViewController:viewController animated:YES];
[viewController release];