我的應用程序有條款&條件頁面。這是應用程序安裝後第一次可見。接受條款後,它永遠不會顯示給用戶。iOS的多重啓動圖像
我已爲第一頁製作啓動圖像,而不是用於術語頁面。但是應用程序安裝後,它應該不是第一次。
那麼我如何使用2啓動圖像基於條件?
如果我只爲我的應用程序(用於iPhone和iPad)設置肖像模式,Apple會拒絕該模式?
謝謝!
我的應用程序有條款&條件頁面。這是應用程序安裝後第一次可見。接受條款後,它永遠不會顯示給用戶。iOS的多重啓動圖像
我已爲第一頁製作啓動圖像,而不是用於術語頁面。但是應用程序安裝後,它應該不是第一次。
那麼我如何使用2啓動圖像基於條件?
如果我只爲我的應用程序(用於iPhone和iPad)設置肖像模式,Apple會拒絕該模式?
謝謝!
我這解決了這種方式:
- (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:@"[email protected]_2" withExtension:@"png"];
NSURL *path = [[NSBundle mainBundle] URLForResource:@"[email protected]" 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!");
}
更新:
代碼在設備上不起作用,請參閱刪除權限否認
順便說一下,如果您始終在模擬器上運行,並且每次運行時都會覆蓋它。在這裏你就沒有機會改變應用程序啓動之前的圖像;)
玩得開心:)
我會回答你這個問題:
謝謝!
謝謝! ,你是說每次應用程序將顯示第一個屏幕而不是術語屏幕。如果安裝後第一次,應用程序將通過動畫從第一個屏幕導航到術語屏幕?請讓我通知詳情。 – arefin
對於第一次顯示,在方法編寫代碼''AppDelegate' applicationDidFinishLaunching' –
它是如何可能,我用編程方式改變啓動圖像是不可能的。請解釋.. – arefin
正如'Nguyen Duc'所說的,爲你的2張圖像創建單獨的'UIViewController',然後去定期Root'UIViewController'。 –