gpt4 book ai didi

ios - 如何创建第二个启动画面(在 ios 中的默认启动画面之后)?

转载 作者:行者123 更新时间:2023-11-28 18:30:41 24 4
gpt4 key购买 nike

我尝试向 iOS 现有项目添加第二个启动画面,这个项目太旧并且使用 xib。

所以我计划先显示默认启动画面,然后在登录页面后显示我自己的图像作为启动画面。

这是我目前所做的

在我的 ViewController.m 文件中,我在 UIView 上创建并添加了一个 UIImageView 它的工作,但问题是我也可以看到导航栏连同第二个闪屏。

我不想要那个导航栏。

请帮帮我代码

ViewController.m   in ViewDidload ()



self.navigationController.navigationBar.hidden=YES;

_splash.frame=CGRectMake(0,0,self.view.frame.size.width,self.view.frame.size.height);
_splashImg.frame=_splash.frame;
[self.view insertSubview:_splash aboveSubview:_loginView];
[NSTimer scheduledTimerWithTimeInterval:3.0f target:self selector:@selector(runMethod) userInfo:nil repeats:NO];
[self.view addSubview:_splashView];
[self.view bringSubviewToFront:_splashView];
UIImageView *img=[[UIImageView alloc]initWithImage:[UIImage imageNamed:@"rss2.png"]];
img.frame=_splashView.frame;
[_splashView addSubview:img];

最佳答案

Apple 只允许每个项目有一个启动画面。您可以通过创建新的 View Controller 将自定义图像显示为启动画面。说 SplashViewController。在 SplashViewController 的 View 上添加一个 imageView 并设置启动图像。

当您想要显示自定义启动画面时加载SplashViewController

在 SplashViewController 的 ViewDidLoad 中:

- (void)viewDidLoad{
[[self navigationController] setNavigationBarHidden:YES animated:YES];
[self performSelector:@selector(loadingNextView)
withObject:nil afterDelay:3.0f];
}

加载下一个 View 的方法

- (void)loadingNextView{
// write code for pushing VC.
}

在您的下一个 View Controller 的 ViewDidLoad 中显示导航栏

[[self navigationController] setNavigationBarHidden:YES animated:YES];

关于ios - 如何创建第二个启动画面(在 ios 中的默认启动画面之后)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31310761/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com