2013-05-03 62 views
-1

我想适应我的应用程序到iPhone 5的视网膜4屏幕,并添加png存档和一切调整大小,但地图视图,移动到顶部,并留下一个白色方形底部。我想知道如何解决它。iphone 5视网膜4英寸mapview

在此先感谢。

enter image description here

也许这有什么关系呢?

- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration { 
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { 
    // We need to manually handle rotation on iPads running iOS 5 and higher to support the new UINavigationBar customization. This is automatic on the iPhone & iPod Touch. 
    if ([self.navigationController.navigationBar respondsToSelector:@selector(setBackgroundImage:forBarMetrics:)]) { 
     if (toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft || 
      toInterfaceOrientation == UIInterfaceOrientationLandscapeRight) { 
      [self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"[email protected]"] forBarMetrics:UIBarMetricsDefault]; 
     } 
     else { 
      [self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"[email protected]"] forBarMetrics:UIBarMetricsDefault]; 
     } 
    } 
} 
else { 
    if (toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft || 
     toInterfaceOrientation == UIInterfaceOrientationLandscapeRight) { 
     [mapView setFrame:CGRectMake(0, 0, 480, 236)]; 
     [toolbar setFrame:CGRectMake(0, 236, 480, 32)]; 
    } 
    else { 
     [mapView setFrame:CGRectMake(0, 0, 320, 372)]; 
     [toolbar setFrame:CGRectMake(0, 372, 320, 44)]; 
    } 

回答

0

您必须以编程方式检查代码中的iPhone设备版本,并相应地调整控件的大小。

1

对于顶部栏应固定在顶部。底部的钢筋锚定在控制器视图的底部。地图视图应该固定在顶部和底部,但也应该有一个垂直弹簧。

现在,当你有一台iPhone 4或5

此外,如果你的目标iOS 6中,采取使用自动版式的时候一切都应该正确地扩大。这样,当iPhoneN具有不同的分辨率时,您不必担心布局如此之多。

+0

嗨,约翰,我按照你所说的来固定一切......但它没有改变。也尝试与iOS 6.1 alutolayout ...没有。感谢您的建议:) – Icarox 2013-05-03 17:52:51

+0

我给这个问题添加了一些代码...我认为这是重点。 – Icarox 2013-05-03 17:57:17

+0

那么你很难编码你的用户界面的框架。你不应该那样做。既然你的目标是iOS 5,你应该使用spring和struts来解决这个问题。或者检查iPhone 5的尺寸并改变框架。 – John 2013-05-07 12:11:52

相关问题