3

私は本当に最善を尽くそうとしていますが、自分のコードで何が問題になっているのかを実際に見つけることができません。私は多くの検索を行いましたが、客観的なCの基本を理解できないと思います;)

私の最初の質問は、以下のコードに関連しています:

[window addSubview:tabBarController.view];

UIImage *image = [UIImage imageNamed:@"lol.png"];
UIImageView *defaultImage = [[UIImageView alloc] initWithImage:image];

これを行うと違いがありますか:

[window addSubview:defaultImage];

またはこれ:

[tabBarController.view addSubview:defaultImage];

2 番目の質問は、スプラッシュ スクリーンの作成についてです。私は自分でやろうとしましたが、何が機能していないのかわかりません (私たちは appDelegate にいます):

[window addSubview:tabBarController.view];

UIImage *image = [UIImage imageNamed:@"lol.png"];
UIImageView *defaultImage = [[UIImageView alloc] initWithImage:image]; 

[window addSubview:defaultImage];
[window makeKeyAndVisible]; //makes the window visible right ?

UIImage *image2 = [UIImage imageNamed:@"lol2.png"];
UIImageView *pubImage = [[UIImageView alloc] initWithImage:image2];

[UIView setAnimationDelegate:self];
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:2.0];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:window cache:YES]; //not sure about the forView:window ...

[defaultImage removeFromSuperview];
[window addSubview:pubImage];

[UIView commitAnimations];

うーん、「makekeyandvisible」と呼んだので、ウィンドウが表示され、アニメーションがユーザーに表示されるはずです...

まあ、うまくいかないので、ステップがありません:D。

ヘルプ歓迎、

ゴーティエ。

4

2 に答える 2

3

「Default.png」という名前のプロジェクトに画像を追加すると、スプラッシュ スクリーンとして機能します。

ユーザーに必要以上に長く画面を見るように強制することは、通常、悪いと見なされます。

とにかく addSubview: を使用して追加したい場合は、正常に動作するはずです。アニメーションが必要な場合は、UIView アニメーションの代わりに CATransitions を調べることができます。

スプラッシュ スクリーンをウィンドウまたはメイン ビュー コントローラーに追加すると、ユーザーには同じように表示されます。

編集:#include <QuartzCore/QuartzCore.h>このスニペットを試してください-QuartzCoreフレームワークを追加する 必要があります

// Using a CATransition
    CATransition* transition = [CATransition animation];
    transition.delegate = self; // if you set this, implement the method below
    transition.duration = 0.3;
    transition.timingFunction = [CAMediaTimingFunction functionWithName: kCAMediaTimingFunctionEaseOut];
    transition.type = kCATransitionMoveIn;
    transition.subtype = kCATransitionFromRight;
    [self.view.layer addAnimation: transition forKey: nil];
    [self.view addSubview: theNewView];

トランジションが終了したときに何かをする必要がある場合は、これを追加します。

#pragma mark -
#pragma mark CAAnimation Delegate Methods
- (void)animationDidStop: (CAAnimation*)theAnimation finished: (BOOL)flag
{
    // Whatever you need to do when the animation is done.
}
于 2010-02-12T19:05:04.727 に答える
0

「「Default.png」という名前のプロジェクトに画像を追加すると、スプラッシュスクリーンとして機能します」という他の回答の最初のステートメントには同意しません。

Default.png は起動イメージです。Apple HIGは、起動イメージとスプラッシュ スクリーンを明確に区別します。

特に、それは言う

以下を提供する機会として起動イメージを使用しないでください。

  • スプラッシュ スクリーンなどの「アプリケーション エントリ エクスペリエンス」
  • Aboutウィンドウ
  • アプリケーションの最初の画面の静的な部分でない限り、ブランディング要素

したがって、スプラッシュ スクリーンの場合NSTimer、ユーザーがスプラッシュ スクリーンを閉じるには または ボタンを使用します。

于 2012-09-12T09:16:15.850 に答える