IOS,UISplitView中的隐藏列表

时间:2012-01-04 22:01:55

标签: ios

这是有效的,但只需点击两下即可获得详情视图以填充屏幕。有什么想法吗?

- (void)toggleSidebar
{
    NSLog(@"HELLO");

    UINavigationController *navController;
    CatalogViewController *viewController;

    for (UIViewController * iview in [self viewControllers]){
        if ([iview class] == [UINavigationController class]) {
            navController = (UINavigationController *)iview;
        } else {
            viewController = (CatalogViewController *)iview;
        }
    }

    if (navController != nil) {
      [[navController view] removeFromSuperview];
    }

    if (viewController != nil) {

        [[viewController view] removeFromSuperview];
        [[self view] setAutoresizesSubviews:YES];

        [[[self view] superview] addSubview:[viewController view]];
        [[viewController view] setFrame:CGRectMake(0, 0, self.view.superview.frame.size.width, self.view.superview.frame.size.height)];
    }
}

基本上我希望拆分视图在我点击按钮时隐藏列表。

0 个答案:

没有答案