支持iPhone 5的屏幕尺寸
问题描述:
注:一切都上了年纪的屏幕尺寸工作得很好,不过新的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个单元格。
答
我结束了
创建单独的厦门国际银行文件_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)
答
它很可能会在你的RootViewController的笔尖设置。对于左侧的“对象”列表中的第一个视图,您可能已经设置了顶栏属性。
答
如果您发现自己设置了导航控制器/导航栏的框架,那么您做错了什么。
大多数情况下,您甚至不需要设置视图控制器视图的框架。
您的应用程序委托不需要任何复杂得多,这一点:
- (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;
}
好的建议可惜的地方我的导航控制器(ontop的的)我的RootViewController上init'ing与导航控制器窗口不为我工作。 – 2013-05-01 20:03:50