带有SingleViewController的UISplitView

时间:2012-03-14 05:42:50

标签: iphone objective-c ios

单击SingleView应用程序后如何添加UISplitView?显然,当用户成功登录后,他们会看到splitView?这怎么可能?请给我指导或者如果可能的话那么代码,因为我是iPhone开发的新手,我对它没有更多的了解?

1 个答案:

答案 0 :(得分:0)

    [UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration: 1.90];
[UIView setAnimationTransition:UIViewAnimationTransitionNone forView:self.navigationController.view cache:YES];

MasterViewController *masterViewController = [[MasterViewController alloc] initWithNibName:@"MasterViewController" bundle:nil];
if (!masternavigationController) {
    masternavigationController = [[UINavigationController alloc] initWithRootViewController:masterViewController];

}
DetailViewController *detailViewController = [[DetailViewController alloc] initWithNibName:@"DetailView" bundle:nil];

if (!splitViewController) {
    splitViewController = [[UISplitViewController alloc] init];
    splitViewController.viewControllers = [NSArray arrayWithObjects:masternavigationController, detailViewController, nil];

    UIViewController *view_controller = (UIViewController *)[navigationController.viewControllers objectAtIndex:([navigationController.viewControllers count]-1)];      
    [masternavigationController.navigationBar setHidden:TRUE];
    [[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeRight animated:NO];


    [splitViewController.view setBounds:CGRectMake(0, 0, 1024, 748)];
    [splitViewController.view setTransform:CGAffineTransformMakeRotation(M_PI / 2)]; 
    [view_controller.view setTransform:CGAffineTransformMakeRotation(M_PI / 2)]; 

    view_controller.view.tag = 17;
    [UIView animateWithDuration:1.05 animations:^{navigationController.view.alpha = 0.0;} completion:^(BOOL finished){

        [navigationController.view addSubview:splitViewController.view];

        [UIView animateWithDuration:1.00 animations:^{navigationController.view.alpha = 1.0;} completion:nil];}];
    rootview *rtview = [[rootview alloc] initWithNibName:@"rootview" bundle:nil];
    rtview.delegate = detailViewController;
    [detailViewController.view addSubview:rtview.view];
    flag = YES;
    [rtview release];
}
[UIView commitAnimations];

//  [NSTimer scheduledTimerWithTimeInterval:0.3 target:self selector:@selector(doneAnimation) userInfo:nil repeats:NO];
[masterViewController release];
[detailViewController release];

这是我们必须添加拆分视图控制器的方法,你必须检查你登录的条件天气,然后用方法调用它