繁体   English   中英

模拟器中iOS6和iOS7的显示屏幕不同

[英]Display screen for iOS6 and iOS7 in simulator is different

在此处输入图片说明

在此处输入图片说明

我的应用程序将为部署目标6.1提供7.0的显示目标,而6.1的显示屏幕则有所不同,因此如何在6.1和7.0中调整大小

iOS 6和iOS 7的主要UI差异在于,iOS 7的viewcontroller中包含状态栏。这意味着您的视图控制器比iOS6大20 px。 您必须调整您的项目。 首先根据iOS 6设计商品,这是更好的方法,您必须进行大量练习,现在将每个商品的Δy设置为20。

或根据iOS 7设计商品并将Δy设置为-20

使用ios7.0及更高版本,然后使用自动布局处理secrren大小

将此代码添加到您的AppDelegate.m中

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    {
     //Whatever your code goes here
  if(kDeviceiPad){

     //adding status bar for IOS7 ipad
         if (IS_IOS7) {
              UIView *addStatusBar = [[UIView alloc] init];
              addStatusBar.frame = CGRectMake(0, 0, 1024, 20);
              addStatusBar.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:1]; //change this to match your navigation bar
              [self.window.rootViewController.view addSubview:addStatusBar];
                    }
                }
    else{

         //adding status bar for IOS7 iphone
        if (IS_IOS7) {
            UIView *addStatusBar = [[UIView alloc] init];
            addStatusBar.frame = CGRectMake(0, 0, 320, 20);
            addStatusBar.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:1]; //You can give your own color pattern
            [self.window.rootViewController.view addSubview:addStatusBar];
        }

    return YES;
   }

可能会有帮助

-(void)adjustFrameForiOS7:(UIView*)v
{
    if([UIDevice currentDevice].systemVersion.floatValue >=7.0)
    {
        [v setFrame:CGRectMake(v.frame.origin.x, v.frame.origin.y+20, v.frame.size.width, v.frame.size.height)];
    }
    else
    {
        [v setFrame:CGRectMake(v.frame.origin.x, v.frame.origin.y, v.frame.size.width, v.frame.size.height)];
    }
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM