代码之家  ›  专栏  ›  技术社区  ›  arachide

有没有可能让导航小车不全屏显示?

  •  0
  • arachide  · 技术社区  · 14 年前

    我有一个UIView(320*300是一个UIViewController的视图),我希望显示UINaviationCotroller并在这个视图大小内控制导航。

    谢谢

    交互开发

    2 回复  |  直到 14 年前
        1
  •  0
  •   bioffe John Petrone    14 年前

    下面您将找到一段代码来实现它。但让我给你一句智慧的话。 别这么做 . 不惜一切代价避免。苹果不建议这么做。你会做噩梦,忙着修补边缘的箱子。它在3.x中运行良好,在iOS 4中,您需要处理许多特殊情况。

    - (void) _adjustViewControllerforTicker {
     TickerView* vv = [ApplicationContext getTickerView];
    if ([PreferenceDataModel isTickerOn]&& self.navigationController.view.frame.origin.y==0) {
    
        CGRect tableRect = self.tableView.frame;
        self.tableView.frame = CGRectMake(tableRect.origin.x,tableRect.origin.y, tableRect.size.width, tableRect.size.height -20);
        UINavigationController *nav = self.navigationController;
        CGRect gframe = CGRectOffset(self.navigationController.view.frame, 0, 20);
        self.navigationController.view.frame = gframe;
        if (!vv) {
            vv = [[TickerView alloc] initWithFrame:CGRectMake(0, 0, 480, 20)];
    
            [nav.view addSubview:vv];
            [vv release];
            self.tableView.contentInset=UIEdgeInsetsMake(0,0,20.0,0.0);
        }
    }   
    if (![PreferenceDataModel isTickerOn]) {
        self.tableView.contentInset= UIEdgeInsetsZero;
        if (vv){
            [vv removeFromSuperview];
            vv=nil;
        }
    }
    

        2
  •  0
  •   Aaron Saunders    14 年前

    对。。你为什么不这么认为?它可能是非标准的,但从技术上讲,它是可以做到的