0

デフォルトの画像が消えた後、アプリにスタートアップアニメーションを挿入したいと思います。私のアプリには、ナビゲーションバーとタブバーがあるので、これをビューに入れようとしましたが、ロードされました:

UIImageView *img = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"myIMG.png"]];
[self.view addSubview:img];

次に、トランジションを使用してその画像をアニメーション化しますが、ビュー内のタブバーとナビゲーションバーの間に配置した画像を使用して、すべての前の画像でアニメーションを開始します。これどうやってするの?

4

5 に答える 5

2

あなたがすべき:

  1. スタートアップViewControllerという名前のViewControllerを作成します。
  2. アプリの起動時にAppDelegateで、このビューをrootViewControllerに設定します
  3. データの読み込み中またはサーバーへの接続中に、画像または必要なものを使用してアニメーションを実行します。
  4. すべてが完了したら、この起動ビューコントローラーから、この起動ビューを削除し、アプリデリゲートを呼び出してメインビューを表示し、メインビューコントローラーをルートビューコントローラーに設定できます。

[編集]

imageViewだけがすべての画面をカバーできるようにしたい場合は、次のように実行できます。

[appDelegate.window addSubview:imageView];
于 2012-06-01T03:01:50.660 に答える
2
  1. スタートアップアニメーション用のViewControllerを作成します
  2. App Delegateで、スタートアップのViewControllerを表示します

AppDelegate.mで

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    ....
    ....
    ....
    frontScreen *animScreen =   [[frontScreen alloc] initWithNibName:@"frontScreen" bundle:nil];
    self.window.rootViewController = animScreen;
    [self.window makeKeyAndVisible];
}
  1. アニメーションが終了したら、showtabviewcontrollerを呼び出します

frontScreen.mで

AppDelegate* app =(AppDelegate*)[UIApplication sharedApplication].delegate;
  [app afterAnimation];

AppDelegate.mで

-(void)afterAnimation {
    rootController *list=[[rootController alloc] initWithNibName:@"rootController" bundle:nil];
    self.navigationController = [[UINavigationController alloc] initWithRootViewController:list];

    self.window.rootViewController = self.navigationController;
    [self.window makeKeyAndVisible]; //optional
  }
于 2012-06-01T03:33:11.737 に答える
2
//Display an Ads Imageview with animation on top of View 
imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"sale2.jpg"]];
UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapDetected:)];
tapGesture.numberOfTapsRequired = 1;
tapGesture.numberOfTouchesRequired = 1;

[imageView addGestureRecognizer:tapGesture];
[imageView setUserInteractionEnabled:YES];
[imageView setMultipleTouchEnabled:YES];

[UIView animateWithDuration:3.5 animations:^{imageView.alpha = 0;imageView.alpha = 1;}];

[self.window addSubview:imageView];



-(void)tapDetected:(UIGestureRecognizer*)recognizer{
  //**************Remove the Advertising Image after the user press single tap on the img
  [UIView animateWithDuration:1 animations:^{imageView.alpha = 1;imageView.alpha = 0;}];
}
于 2012-07-20T08:26:08.080 に答える
0

すべてをカバーする最善の策は、モーダルスタイルのセグエを作成し、そのセグエのビューをアニメーションイメージで埋めることです。アプリが起動すると、プログラムですぐにそのセグエを呼び出すため、最初に表示されます。

于 2012-06-01T02:26:56.170 に答える
0
[self.tabBarController.view addSubview:img];

その後、画像は全画面表示されます。

于 2012-06-01T02:56:18.290 に答える