0

My app has a Terms & Conditions page. It is visible first time after app install. After accept terms it never shows to user.

I have make Launch image for first page, not for terms page. But it should be not standard for first time after app install.

  1. So how I can use 2 launch image based on condition?

  2. If I set Portrait mode only for my app (for both iPhone and iPad), Apple will reject that?

4

2 に答える 2

0

私はこれをこのように解決しました:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];

    // ... stuff

    if( [defaults objectForKey:@"GTCAccepted"] )
    {
        [self performSelector:@selector(gtcAccepted)]; //
    }
    else
    {
        GTCViewController* gtcViewController; // where GTCViewController is a normal UIViewController

        //universal app
        if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
            gtcViewController = [[GTCViewController alloc] initWithNibName:@"GTCViewController-iPad" bundle:nil];
        else
            gtcViewController = [[GTCViewController alloc] initWithNibName:@"GTCViewController" bundle:nil];

        [window setRootViewController:gtcViewController]; // also can show as modal VC
        [gtcViewController release];

        // if accepted, set [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"GTCAccepted"]; in the GTCViewController
    }
}

そしてあなたの2つの起動画像に...

GTC を受け入れた後、このコードを試してください

[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"GTCAccepted"];

NSURL *path2 = [[NSBundle mainBundle] URLForResource:@"Default-568h@2x_2" withExtension:@"png"];
NSURL *path = [[NSBundle mainBundle] URLForResource:@"Default-568h@2x" withExtension:@"png"];

[[NSFileManager defaultManager] removeItemAtURL:path error:nil]; // permission denied

if([[NSFileManager defaultManager] copyItemAtURL:path2 toURL:path error:nil])
{
    NSLog(@"startItem replaced!");
}else
{
    NSLog(@"oh oh... item not replaced!");
}

更新:
コードはデバイスで機能しません。削除時に権限が拒否されたことを確認してください

ちなみに、Xcode から起動して Always on Simulator で実行すると、実行するたびにこれが上書きされます。ここでは、アプリが起動する前に画像を変更する機会がありません.

于 2013-05-21T07:35:08.403 に答える