羊羊羊羊 2013-04-22 02:07 采纳率: 0%
浏览 1017

将应用迁移到iphone5 retina4中

以前用同样的方法成功迁移过应用,但是这个应用不知道为什么不行。

迁移步骤相同,但是现在得不到xib布局来设置窗口自动调整大小,因为TabBarViewController 定义为根控制器,并且应用的顶置状态条和前段都变成黑色的了。

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

    tabBarController = [[UITabBarController alloc] init];

    NSArray *viewControllers = [NSArray alloc];

    viewControllers = [NSArray arrayWithObjects: nil];

    // Attach them to the tab bar controller
    [self.tabBarController setViewControllers:viewControllers animated:NO];

    // Put the tabBarController's view on the window.
    [window addSubview:[self.tabBarController view]];

    self.window.rootViewController = self.tabBarController;

    [self.window makeKeyWindow];

    self.splashController = [[splashViewController alloc] initWithNibName:@"splashViewController" bundle:nil aidioma:self.idioma];
    [self.window addSubview:[splashController view]];
    [self.window makeKeyAndVisible];
  • 写回答

1条回答

  • ChatGPTᴼᴾᴱᴺᴬᴵ 2022-12-21 15:55
    关注

    ChatGPT尝试为您解答,仅供参考
    您好!看起来您的应用的启动流程没有问题。但是,可能是因为您在加载 tabBarController 时未提供任何视图控制器,所以它没有显示任何内容。您需要在加载视图控制器的数组中提供至少一个视图控制器。

    例如:

    NSArray *viewControllers = [NSArray arrayWithObjects: firstViewController, secondViewController, nil];
    [self.tabBarController setViewControllers:viewControllers animated:NO];
    

    您也可以通过设置每个视图控制器的标题和图标来定义每个选项卡,例如:

    firstViewController.title = @"First";
    firstViewController.tabBarItem.image = [UIImage imageNamed:@"first_icon"];
    
    secondViewController.title = @"Second";
    secondViewController.tabBarItem.image = [UIImage imageNamed:@"second_icon"];
    
    评论

报告相同问题?

悬赏问题

  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示