2013-04-29 211 views
0

注:一切都上了年紀的屏幕尺寸工作得很好,不過新的iPhone屏幕上(640x1136)事情的方式來遠了支持iPhone 5的屏幕尺寸

這裏是應用程序代理INITING和顯示myRootViewController

myRootViewController = [[RootViewController alloc] initWithNibName:@"RootViewController" bundle:[NSBundle mainBundle]]; 

    [myRootViewController.view setFrame:[[UIScreen mainScreen] applicationFrame]]; 

    //NSLog(@"rootviewcontroller1 frame %@", NSStringFromCGRect(myRootViewController.view.frame)); 
    //OUTPUTS: {{0, 0}, {320, 460}} 

    [window addSubview:myRootViewController.view]; 

RootViewController在將其添加到其視圖之前爲「navigationController」和其他一些視圖設置框架。

//NSLog(@"ogtest rootviewcontroller frame2 %@", NSStringFromCGRect(self.view.frame)); 
//OUTPUTS: {{0, 20}, {320, 548}} 



    [navigationController.view setFrame:CGRectMake(0, 0, 320,528)]; 
//I have tried multiples variations including not setting it. 

     loadingView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)]; 
     [loadingView setBackgroundColor:[UIColor clearColor]]; 
     UILabel *_loadingLable = [[UILabel alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 80.0f, 20.0f)]; 
     _loadingLable.backgroundColor = [UIColor clearColor]; 
     _loadingLable.textColor = [UIColor whiteColor]; 
     _loadingLable.text = @"Loading..."; 
     [_loadingLable setCenter:CGPointMake(181.0f, 240.0f)]; 
     activityIndicatior = [[UIActivityIndicatorView alloc]initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge]; 
     [activityIndicatior setCenter:CGPointMake(120.0f, 240.0f)]; 

     RoundedView *_roundedRectangle = [[RoundedView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 140.0f, 50.0f) roundedCorner:RoundedCornersTypeALL]; 
     _roundedRectangle.center = CGPointMake(160.0, 240.0); 
     _roundedRectangle.rectColor = [UIColor blackColor]; 
     _roundedRectangle.alpha = 0.7; 
     [loadingView addSubview:_roundedRectangle]; 
     [loadingView addSubview:activityIndicatior]; 
     [loadingView addSubview:_loadingLable]; 
     [_loadingLable release]; 
     [_roundedRectangle release]; 

     [loadingView setHidden:YES]; 

     [self.view addSubview:[navigationController view]]; 
     [self.view addSubview: loadingView]; 

你可以從下面的圖片看到,灰色的條是那裏的導航欄。帶箭頭按鈕的文本「4月30日星期二...」應該佔據該灰色區域,而不是從頂部的2個單元格。

enter image description here

回答

0

我結束了

創建單獨的廈門國際銀行文件_iPhone_Retina

在文件末尾名稱

其中還要求像t他

if (IS_IPHONE_RETINA) { 
       View = [[View alloc] initWithNibName:@"View_iPhone_Retina" bundle:[NSBundle mainBundle]]; 
      }else{ 
       View = [[View alloc] initWithNibName:@"View" bundle:[NSBundle mainBundle]]; 
      } 

IS_IPHONE_RETINA在projectname.pch文件中定義爲

#define IS_IPHONE_RETINA ([[UIScreen mainScreen] bounds].size.height == 568) 
0

它很可能會在你的RootViewController的筆尖設置。對於左側的「對象」列表中的第一個視圖,您可能已經設置了頂欄屬性。

1

如果您發現自己設置了導航控制器/導航欄的框架,那麼您做錯了什麼。

大多數情況下,您甚至不需要設置視圖控制器視圖的框架。

您的應用程序委託不需要任何複雜得多,這一點:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 
{ 
    [self setWindow:[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]]; 

    [[self window] setRootViewController:[[UINavigationController alloc] initWithRootViewController:[[RootViewController alloc] init]]; 

    [self.window makeKeyAndVisible]; 

    return YES; 
} 
+0

好的建議可惜的地方我的導航控制器(ontop的的)我的RootViewController上init'ing與導航控制器窗口不爲我工作。 – 2013-05-01 20:03:50