如何在我的iPhone应用程序中添加两个启动画面?

时间:2012-07-31 10:39:19

标签: iphone objective-c ios xcode

我正在创建一个应用程序,其中我在所提供的区域中放置了default.png并将sleep(5);添加到我的应用代理中,目前运行正常。

我需要做的是在应用启动时添加多个图像,这样我就可以获得一个2.5秒的启动画面和2.5秒的另一个启动画面。

如何在启动时显示2个启动画面?

4 个答案:

答案 0 :(得分:3)

无法使用两个闪屏。创建一个视图控制器,其中UIImageView填充第二个图像并显示2.5秒。

答案 1 :(得分:0)

只需将图片添加到视图控制器中,2.5秒后,将其从视图中删除。

答案 2 :(得分:0)

您可以在主视图的顶部轻松实现视图,但在appDelegate中。例如,如果您想要一个淡出到主视图的启动图像:(或一个看似淡出的默认图像:只需将相同的图像放在启动画面和默认屏幕上)。只要它是主视图,这也为您提供了正确的方向。

只需将其添加到您的

中即可

应用程序:(UIApplication *)应用程序didFinishLaunchingWithOptions:

方法:

Exception in thread "main" java.lang.UnsupportedOperationException: No Encoder found for com.company.MyEnum.Value
- field (class: "scala.Enumeration.Value", name: "other")
- root class: "com.company.MyData"
at org.apache.spark.sql.catalyst.ScalaReflection$.org$apache$spark$sql$catalyst$ScalaReflection$$extractorFor(ScalaReflection.scala:597)
at org.apache.spark.sql.catalyst.ScalaReflection$$anonfun$org$apache$spark$sql$catalyst$ScalaReflection$$extractorFor$1.apply(ScalaReflection.scala:509)
at org.apache.spark.sql.catalyst.ScalaReflection$$anonfun$org$apache$spark$sql$catalyst$ScalaReflection$$extractorFor$1.apply(ScalaReflection.scala:502)
at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:251)
at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:251)
at scala.collection.immutable.List.foreach(List.scala:318)
at scala.collection.TraversableLike$class.flatMap(TraversableLike.scala:251)
at scala.collection.AbstractTraversable.flatMap(Traversable.scala:105)
at org.apache.spark.sql.catalyst.ScalaReflection$.org$apache$spark$sql$catalyst$ScalaReflection$$extractorFor(ScalaReflection.scala:502)
at org.apache.spark.sql.catalyst.ScalaReflection$.extractorsFor(ScalaReflection.scala:394)
at org.apache.spark.sql.catalyst.encoders.ExpressionEncoder$.apply(ExpressionEncoder.scala:54)
at org.apache.spark.sql.SQLImplicits.newProductEncoder(SQLImplicits.scala:41)
at com.company.EnumTest$.main(EnumTest.scala:22)
at com.company.EnumTest.main(EnumTest.scala)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)

答案 3 :(得分:-3)

嗨,请尝试使用下面的代码,它真的为你充分hwlp亲爱的,我建议使用这个......

- (BOOL)应用程序:(UIApplication )应用程序didFinishLaunchingWithOptions :( NSDictionary )launchOptions

{

self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];

// Override point for customization after application launch.

MasterViewController *masterViewController = [[[MasterViewController alloc] initWithNibName:@"MasterViewController" bundle:nil] autorelease];

self.navigationController = [[[UINavigationController alloc] initWithRootViewController:masterViewController] autorelease];

UIImageView *imageView = [[[UIImageView alloc] initWithFrame:self.window.bounds] autorelease];

UIImage *image = [UIImage imageNamed:@"Welcome.png"];
if (!image)
{
    NSLog(@"Something went wrong trying to get the UIImage. Check filenames");
}

imageView.image = image;

[self.window addSubview:imageView];
[self.window makeKeyAndVisible];

[self performSelector:@selector(removeFirstSplash:) withObject:imageView afterDelay:3];

return YES;

}

- (void)removeFirstSplash:(UIImageView *)oldImageView

{

UIImageView *imageView = [[[UIImageView alloc] initWithFrame:self.window.bounds] autorelease];

UIImage *image = [UIImage imageNamed:@"Splash.png"];

imageView.image = image;

[self.window addSubview:imageView];

[self performSelector:@selector(removeSecondSplash:) withObject:imageView afterDelay:3];

[oldImageView removeFromSuperview];

}

- (void)removeSecondSplash:(UIImageView *)oldImageView

{

[self.window addSubview:self.navigationController.view];

[oldImageView removeFromSuperview];

}